diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2010-02-27 14:22:55 (GMT) |
commit | 3f626c3e14f2fe5fdecc38d4265d74f8315b3490 (patch) | |
tree | 357b32156e211a33841e44b7a224313c7072ee46 /tests | |
parent | 57ce77e953b618739f6f1aec67f8e0de97e05b08 (diff) | |
parent | 6396e7a15079cb157caef319348a0bcd0b95a6a7 (diff) | |
download | Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.zip Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.gz Qt-3f626c3e14f2fe5fdecc38d4265d74f8315b3490.tar.bz2 |
Merge remote branch 'origin/master' into 4.7
Conflicts:
src/corelib/kernel/qmetatype.cpp
src/declarative/graphicsitems/qdeclarativeevents.cpp
src/declarative/graphicsitems/qdeclarativeflickable.cpp
src/declarative/graphicsitems/qdeclarativegridview.cpp
src/declarative/qml/qdeclarativescript.cpp
src/declarative/util/qdeclarativeanimation.cpp
src/declarative/util/qdeclarativebehavior.cpp
src/declarative/util/qdeclarativeeasefollow.cpp
src/declarative/util/qdeclarativefontloader.cpp
src/declarative/util/qdeclarativelistmodel.cpp
src/declarative/util/qdeclarativespringfollow.cpp
src/declarative/util/qdeclarativestategroup.cpp
src/declarative/util/qdeclarativesystempalette.cpp
src/declarative/util/qdeclarativetimer.cpp
src/declarative/util/qmlstateoperations.cpp
src/multimedia/qml/qdeclarativeaudio.cpp
src/multimedia/qml/qdeclarativevideo.cpp
Diffstat (limited to 'tests')
-rw-r--r-- | tests/auto/auto.pro | 12 | ||||
-rw-r--r-- | tests/auto/declarative/declarative.pro | 108 | ||||
-rw-r--r-- | tests/auto/declarative/examples/tst_examples.cpp | 11 | ||||
-rw-r--r-- | tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml | 1 | ||||
-rw-r--r-- | tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp | 10 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/data/layouts.qml | 1 | ||||
-rw-r--r-- | tests/auto/declarative/layouts/tst_layouts.cpp | 33 | ||||
-rw-r--r-- | tests/auto/declarative/parserstress/tst_parserstress.cpp | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/anchors.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/anchors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/centerin.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/centerin.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/crash1.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/crash1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/fill.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/fill.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/loop1.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/loop1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/loop2.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/loop2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/data/margins.qml (renamed from tests/auto/declarative/qmlgraphicsanchors/data/margins.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp | 448 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/colors.gif (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.gif) | bin | 505 -> 505 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/colors.qml (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.gif (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.gif) | bin | 164923 -> 164923 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.qml (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanpause.qml (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanpause.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanstopped.qml (renamed from tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanstopped.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp | 191 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/attached.qml (renamed from tests/auto/declarative/qmlanimations/data/attached.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badproperty1.qml (renamed from tests/auto/declarative/qmlanimations/data/badproperty1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badproperty2.qml (renamed from tests/auto/declarative/qmlanimations/data/badproperty2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml (renamed from tests/auto/declarative/qmlanimations/data/badtype1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml (renamed from tests/auto/declarative/qmlanimations/data/badtype2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml (renamed from tests/auto/declarative/qmlanimations/data/badtype3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/badtype4.qml (renamed from tests/auto/declarative/qmlanimations/data/badtype4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml (renamed from tests/auto/declarative/qmlanimations/data/dontAutoStart.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml (renamed from tests/auto/declarative/qmlanimations/data/dontStart.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/dontStart2.qml (renamed from tests/auto/declarative/qmlanimations/data/dontStart2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/dotproperty.qml (renamed from tests/auto/declarative/qmlanimations/data/dotproperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/mixedtype1.qml (renamed from tests/auto/declarative/qmlanimations/data/mixedtype1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/mixedtype2.qml (renamed from tests/auto/declarative/qmlanimations/data/mixedtype2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/properties.qml (renamed from tests/auto/declarative/qmlanimations/data/properties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/properties2.qml (renamed from tests/auto/declarative/qmlanimations/data/properties2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/properties3.qml (renamed from tests/auto/declarative/qmlanimations/data/properties3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/properties4.qml (renamed from tests/auto/declarative/qmlanimations/data/properties4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/properties5.qml (renamed from tests/auto/declarative/qmlanimations/data/properties5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition2.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition3.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition4.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition5.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition6.qml (renamed from tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml (renamed from tests/auto/declarative/qmlanimations/data/valuesource.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml (renamed from tests/auto/declarative/qmlanimations/data/valuesource2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp | 672 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/binding.qml (renamed from tests/auto/declarative/qmlbehaviors/data/binding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/color.qml (renamed from tests/auto/declarative/qmlbehaviors/data/color.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml (renamed from tests/auto/declarative/qmlbehaviors/data/cpptrigger.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml (renamed from tests/auto/declarative/qmlbehaviors/data/disabled.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml (renamed from tests/auto/declarative/qmlbehaviors/data/dontStart.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/empty.qml (renamed from tests/auto/declarative/qmlbehaviors/data/empty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml (renamed from tests/auto/declarative/qmlbehaviors/data/explicit.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml (renamed from tests/auto/declarative/qmlbehaviors/data/groupProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml (renamed from tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/loop.qml (renamed from tests/auto/declarative/qmlbehaviors/data/loop.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml (renamed from tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/parent.qml (renamed from tests/auto/declarative/qmlbehaviors/data/parent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml (renamed from tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml (renamed from tests/auto/declarative/qmlbehaviors/data/scripttrigger.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/data/simple.qml (renamed from tests/auto/declarative/qmlbehaviors/data/simple.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp | 301 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/data/test-binding.qml (renamed from tests/auto/declarative/qmlbinding/data/test-binding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml (renamed from tests/auto/declarative/qmlbinding/data/test-binding2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp | 107 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/data/colors-round.sci (renamed from tests/auto/declarative/qmlgraphicsborderimage/data/colors-round.sci) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/data/colors.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors.png) | bin | 1655 -> 1655 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/data/invalid.sci (renamed from tests/auto/declarative/qmlgraphicsborderimage/data/invalid.sci) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp | 351 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml | 3 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml | 3 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/data/trimming.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp | 135 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp | 434 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp | 150 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp | 843 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp | 157 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp | 190 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/data/MyComponent.qml (renamed from tests/auto/declarative/qmldom/data/MyComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/data/MyItem.qml (renamed from tests/auto/declarative/qmldom/data/MyItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/data/importdir/Bar.qml (renamed from tests/auto/declarative/qmldom/data/importdir/Bar.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir/Foo.qml (renamed from tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/data/top.qml (renamed from tests/auto/declarative/qmldom/data/top.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp | 1313 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml (renamed from tests/auto/declarative/qmleasefollow/data/easefollow1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml (renamed from tests/auto/declarative/qmleasefollow/data/easefollow2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml (renamed from tests/auto/declarative/qmleasefollow/data/easefollow3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp | 122 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml (renamed from tests/auto/declarative/qmlecmascript/data/ConstantsOverrideBindings.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/CustomObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/MethodsObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml (renamed from tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/ScopeObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/TypeForDynamicCreation.qml (renamed from tests/auto/declarative/qmlecmascript/data/TypeForDynamicCreation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml (renamed from tests/auto/declarative/qmlecmascript/data/aliasPropertyAndBinding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/assignBasicTypes.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml (renamed from tests/auto/declarative/qmlecmascript/data/assignBasicTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.qml (renamed from tests/auto/declarative/qmlecmascript/data/attachedProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml (renamed from tests/auto/declarative/qmlecmascript/data/bindingLoop.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/bug.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml (renamed from tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.3.qml (renamed from tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/declarativeToString.qml (renamed from tests/auto/declarative/qmlecmascript/data/qmlToString.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/deferredProperties.qml (renamed from tests/auto/declarative/qmlecmascript/data/deferredProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/deletedObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.helper.qml (renamed from tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml (renamed from tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/dynamicDeletion.qml (renamed from tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/enums.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/enums.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/enums.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/enums.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/exceptionClearsOnReeval.qml (renamed from tests/auto/declarative/qmlecmascript/data/exceptionClearsOnReeval.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml (renamed from tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml (renamed from tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml (renamed from tests/auto/declarative/qmlecmascript/data/extendedObjectPropertyLookup.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml (renamed from tests/auto/declarative/qmlecmascript/data/extensionObjects.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.2.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js (renamed from tests/auto/declarative/qmlecmascript/data/externalScript.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml (renamed from tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/jsObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml (renamed from tests/auto/declarative/qmlecmascript/data/listProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml (renamed from tests/auto/declarative/qmlecmascript/data/listToVariant.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/methods.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/methods.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml (renamed from tests/auto/declarative/qmlecmascript/data/methods.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml (renamed from tests/auto/declarative/qmlecmascript/data/methods.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml (renamed from tests/auto/declarative/qmlecmascript/data/methods.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml (renamed from tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml (renamed from tests/auto/declarative/qmlecmascript/data/objectsCompareAsEqual.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml (renamed from tests/auto/declarative/qmlecmascript/data/outerBindingOverridesInnerBinding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/scope.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scope.qml (renamed from tests/auto/declarative/qmlecmascript/data/scope.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js (renamed from tests/auto/declarative/qmlecmascript/data/scriptAccess.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml (renamed from tests/auto/declarative/qmlecmascript/data/scriptAccess.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js (renamed from tests/auto/declarative/qmlecmascript/data/scriptErrors.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml (renamed from tests/auto/declarative/qmlecmascript/data/scriptErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.qml (renamed from tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml (renamed from tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml (renamed from tests/auto/declarative/qmlecmascript/data/signalAssignment.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/signalAssignment.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml (renamed from tests/auto/declarative/qmlecmascript/data/signalParameterTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml (renamed from tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml (renamed from tests/auto/declarative/qmlecmascript/data/transientErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.2.qml (renamed from tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.qml (renamed from tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/data/valueTypeFunctions.qml (renamed from tests/auto/declarative/qmlecmascript/data/valueTypeFunctions.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp | 85 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/testtypes.h | 598 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp | 1662 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp | 240 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeerror/test.txt (renamed from tests/auto/declarative/qmlerror/test.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp | 242 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml (renamed from tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml | 16 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp | 223 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml (renamed from tests/auto/declarative/qmlgraphicsflipable/data/test-flipable.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp | 113 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf (renamed from tests/auto/declarative/qmlfontloader/data/dummy.ttf) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf (renamed from tests/auto/declarative/qmlfontloader/data/tarzeau_ocr_a.ttf) | bin | 24544 -> 24544 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp | 156 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml | 39 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml (renamed from tests/auto/declarative/qmlgraphicsgridview/data/gridview-initCurrent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/gridview.qml (renamed from tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/gridview2.qml (renamed from tests/auto/declarative/qmlgraphicsgridview/data/gridview2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/gridview3.qml (renamed from tests/auto/declarative/qmlgraphicsgridview/data/gridview3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/data/setindex.qml | 33 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp | 1022 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/data/colors.png (renamed from tests/auto/declarative/qmlgraphicsimage/data/colors.png) | bin | 1655 -> 1655 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/data/colors1.png (renamed from tests/auto/declarative/qmlgraphicsborderimage/data/colors.png) | bin | 1655 -> 1655 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 253 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimageprovider/data/exists.png (renamed from tests/auto/declarative/qmlpixmapcache/data/exists.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimageprovider/data/exists1.png (renamed from tests/auto/declarative/qmlpixmapcache/data/exists1.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimageprovider/data/exists2.png (renamed from tests/auto/declarative/qmlpixmapcache/data/exists2.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp | 166 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml (renamed from tests/auto/declarative/qmlinfo/data/NestedObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml (renamed from tests/auto/declarative/qmlinfo/data/nestedQmlObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml (renamed from tests/auto/declarative/qmlinfo/data/qmlObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp | 139 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp | 585 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml (renamed from tests/auto/declarative/qmlgraphicsitem/data/keynavigation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/data/keys.qml (renamed from tests/auto/declarative/qmlgraphicsitem/data/keys.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp | 318 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/Alias.qml (renamed from tests/auto/declarative/qmllanguage/data/Alias.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml (renamed from tests/auto/declarative/qmllanguage/data/Alias2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml (renamed from tests/auto/declarative/qmllanguage/data/Alias3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml (renamed from tests/auto/declarative/qmllanguage/data/Alias4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml (renamed from tests/auto/declarative/qmllanguage/data/ComponentComposite.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml (renamed from tests/auto/declarative/qmllanguage/data/CompositeType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/CompositeType2.qml (renamed from tests/auto/declarative/qmllanguage/data/CompositeType2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml (renamed from tests/auto/declarative/qmllanguage/data/CompositeType3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/CompositeType4.qml (renamed from tests/auto/declarative/qmllanguage/data/CompositeType4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml (renamed from tests/auto/declarative/qmllanguage/data/DynamicPropertiesNestedType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml (renamed from tests/auto/declarative/qmllanguage/data/HelperAlias.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/I18n.qml (renamed from tests/auto/declarative/qmllanguage/data/I18n.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/I18nType30.qml (renamed from tests/auto/declarative/qmllanguage/data/I18nType30.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/MyComponent.qml (renamed from tests/auto/declarative/qmllanguage/data/MyComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/MyCompositeValueSource.qml (renamed from tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/MyContainerComponent.qml (renamed from tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml (renamed from tests/auto/declarative/qmllanguage/data/NestedAlias.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml (renamed from tests/auto/declarative/qmllanguage/data/NestedErrorsType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml (renamed from tests/auto/declarative/qmllanguage/data/OnCompletedType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.2.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.4.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.8.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml (renamed from tests/auto/declarative/qmllanguage/data/alias.9.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml (renamed from tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml (renamed from tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignLiteralSignalProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignObjectToSignal.qml (renamed from tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml (renamed from tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignQmlComponent.qml (renamed from tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignSignal.qml (renamed from tests/auto/declarative/qmllanguage/data/assignSignal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/assignTypeExtremes.qml (renamed from tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml (renamed from tests/auto/declarative/qmllanguage/data/attachedProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/autoComponentCreation.qml (renamed from tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/autoNotifyConnection.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/component.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.1.qml (renamed from tests/auto/declarative/qmllanguage/data/component.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/component.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.2.qml (renamed from tests/auto/declarative/qmllanguage/data/component.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/component.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.3.qml (renamed from tests/auto/declarative/qmllanguage/data/component.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/component.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.4.qml (renamed from tests/auto/declarative/qmllanguage/data/component.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.5.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.5.qml (renamed from tests/auto/declarative/qmllanguage/data/component.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/component.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/component.6.qml (renamed from tests/auto/declarative/qmllanguage/data/component.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml (renamed from tests/auto/declarative/qmllanguage/data/componentCompositeType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.2.qml (renamed from tests/auto/declarative/qmllanguage/data/cppnamespace.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.qml (renamed from tests/auto/declarative/qmllanguage/data/cppnamespace.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/crash2.qml (renamed from tests/auto/declarative/qmllanguage/data/crash2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml (renamed from tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml (renamed from tests/auto/declarative/qmllanguage/data/customParserTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/customVariantTypes.qml (renamed from tests/auto/declarative/qmllanguage/data/customVariantTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml (renamed from tests/auto/declarative/qmllanguage/data/declaredPropertyValues.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/defaultGrouped.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml (renamed from tests/auto/declarative/qmllanguage/data/defaultGrouped.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml (renamed from tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/doubleSignal.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.qml (renamed from tests/auto/declarative/qmllanguage/data/doubleSignal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.qml (renamed from tests/auto/declarative/qmllanguage/data/duplicateIDs.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml (renamed from tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml (renamed from tests/auto/declarative/qmllanguage/data/dynamicObjectProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml (renamed from tests/auto/declarative/qmllanguage/data/dynamicProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml (renamed from tests/auto/declarative/qmllanguage/data/dynamicPropertiesNested.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml (renamed from tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/empty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/empty.qml (renamed from tests/auto/declarative/qmllanguage/data/empty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/emptySignal.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml (renamed from tests/auto/declarative/qmllanguage/data/emptySignal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/failingComponent.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/failingComponentTest.qml (renamed from tests/auto/declarative/qmllanguage/data/failingComponentTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/finalOverride.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/finalOverride.qml (renamed from tests/auto/declarative/qmllanguage/data/finalOverride.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyNames.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyUse.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nNameSpace.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nScript.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nStrings.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nStrings.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/i18nType.qml (renamed from tests/auto/declarative/qmllanguage/data/i18nType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/idProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml (renamed from tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.qml (renamed from tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.qml (renamed from tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml (renamed from tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/interfaceProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/interfaceQList.qml (renamed from tests/auto/declarative/qmllanguage/data/interfaceQList.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidID.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidID.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidID.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidImportID.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml (renamed from tests/auto/declarative/qmllanguage/data/invalidRoot.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml (renamed from tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml (renamed from tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml (renamed from tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir (renamed from tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.qml (renamed from tests/auto/declarative/qmllanguage/data/listAssignment.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.qml (renamed from tests/auto/declarative/qmllanguage/data/listAssignment.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml (renamed from tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml (renamed from tests/auto/declarative/qmllanguage/data/listProperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingObject.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/missingObject.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml (renamed from tests/auto/declarative/qmllanguage/data/missingObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingSignal.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml (renamed from tests/auto/declarative/qmllanguage/data/missingSignal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nestedErrors.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml (renamed from tests/auto/declarative/qmllanguage/data/nestedErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.qml (renamed from tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/nullDotProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml (renamed from tests/auto/declarative/qmllanguage/data/onCompleted.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/property.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.1.qml (renamed from tests/auto/declarative/qmllanguage/data/property.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/property.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.2.qml (renamed from tests/auto/declarative/qmllanguage/data/property.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/property.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.3.qml (renamed from tests/auto/declarative/qmllanguage/data/property.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/property.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.4.qml (renamed from tests/auto/declarative/qmllanguage/data/property.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/property.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/property.5.qml (renamed from tests/auto/declarative/qmllanguage/data/property.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml (renamed from tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml (renamed from tests/auto/declarative/qmllanguage/data/propertyValueSource.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml (renamed from tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml (renamed from tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.qml (renamed from tests/auto/declarative/qmllanguage/data/readOnly.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.qml (renamed from tests/auto/declarative/qmllanguage/data/readOnly.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/readOnly.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml (renamed from tests/auto/declarative/qmllanguage/data/readOnly.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/rootAsQmlComponent.qml (renamed from tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.1.qml (renamed from tests/auto/declarative/qmllanguage/data/script.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.10.qml (renamed from tests/auto/declarative/qmllanguage/data/script.10.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.11.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.11.qml (renamed from tests/auto/declarative/qmllanguage/data/script.11.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.12.qml (renamed from tests/auto/declarative/qmllanguage/data/script.12.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.2.qml (renamed from tests/auto/declarative/qmllanguage/data/script.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.3.qml (renamed from tests/auto/declarative/qmllanguage/data/script.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.4.qml (renamed from tests/auto/declarative/qmllanguage/data/script.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.5.qml (renamed from tests/auto/declarative/qmllanguage/data/script.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.6.qml (renamed from tests/auto/declarative/qmllanguage/data/script.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.7.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.7.qml (renamed from tests/auto/declarative/qmllanguage/data/script.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/script.8.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.8.qml (renamed from tests/auto/declarative/qmllanguage/data/script.8.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/script.9.qml (renamed from tests/auto/declarative/qmllanguage/data/script.9.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/scriptString.qml (renamed from tests/auto/declarative/qmllanguage/data/scriptString.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/signal.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml (renamed from tests/auto/declarative/qmllanguage/data/signal.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/signal.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml (renamed from tests/auto/declarative/qmllanguage/data/signal.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/signal.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml (renamed from tests/auto/declarative/qmllanguage/data/signal.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/simpleBindings.qml (renamed from tests/auto/declarative/qmllanguage/data/simpleBindings.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/simpleContainer.qml (renamed from tests/auto/declarative/qmllanguage/data/simpleContainer.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/simpleObject.qml (renamed from tests/auto/declarative/qmllanguage/data/simpleObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/Test.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml (renamed from tests/auto/declarative/qmllanguage/data/subdir/subsubdir/SubTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/test.js (renamed from tests/auto/declarative/qmllanguage/data/test.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/test2.js (renamed from tests/auto/declarative/qmllanguage/data/test2.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.qml (renamed from tests/auto/declarative/qmllanguage/data/unregisteredObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.qml (renamed from tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/valueTypes.qml (renamed from tests/auto/declarative/qmllanguage/data/valueTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.10.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.11.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.12.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.13.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.14.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.15.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.8.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.errors.txt (renamed from tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.qml (renamed from tests/auto/declarative/qmllanguage/data/wrongType.9.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/LocalInternal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml (renamed from tests/auto/declarative/qmllanguage/data/subdir/Test.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestLocal.qml (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestLocal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestSubDir.qml (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestSubDir.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/pics/blue.png (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/pics/blue.png) | bin | 84 -> 84 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/qmldir) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir (renamed from tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/qmldir) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/testtypes.cpp | 62 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/testtypes.h | 554 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp | 1406 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp | 346 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistreference/data/MyType.qml (renamed from tests/auto/declarative/qmllist/data/MyType.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml (renamed from tests/auto/declarative/qmllist/data/engineTypes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml (renamed from tests/auto/declarative/qmllist/data/variantToList.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp | 580 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/displaylist.qml | 43 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/itemlist.qml (renamed from tests/auto/declarative/qmlgraphicslistview/data/itemlist.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml (renamed from tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml (renamed from tests/auto/declarative/qmlgraphicslistview/data/listview-initCurrent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml (renamed from tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/data/listview.qml | 119 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp | 1413 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/NoResize.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/NoResize.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/Rect120x60.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/SetSourceComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/SizeToItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml (renamed from tests/auto/declarative/qmlgraphicsloader/data/SizeToLoader.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro | 11 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp | 464 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp | 378 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml (renamed from tests/auto/declarative/qmlmoduleplugin/plugin.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp | 85 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp | 117 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml (renamed from tests/auto/declarative/qmlgraphicsmousearea/data/dragproperties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp | 138 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp | 222 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeparticles/data/particle.png (renamed from tests/auto/declarative/qmlgraphicsparticles/data/particle.png) | bin | 262 -> 262 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml | 33 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeparticles/data/particles.qml (renamed from tests/auto/declarative/qmlgraphicsparticles/data/particles.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp | 209 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/datamodel.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/displaypath.qml | 60 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/path.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/path.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathview.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/pathview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathview1.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/pathview1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathview2.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/pathview2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/data/pathview3.qml (renamed from tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp | 529 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/data/exists.png (renamed from tests/auto/declarative/qmlimageprovider/data/exists.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/data/exists1.png (renamed from tests/auto/declarative/qmlimageprovider/data/exists1.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/data/exists2.png (renamed from tests/auto/declarative/qmlimageprovider/data/exists2.png) | bin | 2738 -> 2738 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp | 282 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/grid-spacing.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/grid.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/grid.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/horizontal-spacing.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/horizontal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/propertychanges.qml | 39 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/repeater.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/repeater.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/vertical-spacing.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/data/vertical.qml (renamed from tests/auto/declarative/qmlgraphicspositioners/data/vertical.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp | 455 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp | 1322 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp | 171 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/closestangle.qml (renamed from tests/auto/declarative/qmlqt/data/closestangle.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml (renamed from tests/auto/declarative/qmlqt/data/consoleLog.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createComponent.qml (renamed from tests/auto/declarative/qmlqt/data/createComponent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml (renamed from tests/auto/declarative/qmlqt/data/createComponentData.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml (renamed from tests/auto/declarative/qmlqt/data/createQmlObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/darker.qml (renamed from tests/auto/declarative/qmlqt/data/darker.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/enums.qml (renamed from tests/auto/declarative/qmlqt/data/enums.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/hsla.qml (renamed from tests/auto/declarative/qmlqt/data/hsla.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/lighter.qml (renamed from tests/auto/declarative/qmlqt/data/lighter.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/md5.qml (renamed from tests/auto/declarative/qmlqt/data/md5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/point.qml (renamed from tests/auto/declarative/qmlqt/data/point.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/rect.qml (renamed from tests/auto/declarative/qmlqt/data/rect.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/rgba.qml (renamed from tests/auto/declarative/qmlqt/data/rgba.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/size.qml (renamed from tests/auto/declarative/qmlqt/data/size.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/tint.qml (renamed from tests/auto/declarative/qmlqt/data/tint.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/data/vector.qml (renamed from tests/auto/declarative/qmlqt/data/vector.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp | 369 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/objlist.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/properties.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/properties.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/repeater.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/repeater.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml (renamed from tests/auto/declarative/qmlgraphicsrepeater/data/repeater2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp | 385 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativespringfollow/data/springfollow1.qml (renamed from tests/auto/declarative/qmlspringfollow/data/springfollow1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml (renamed from tests/auto/declarative/qmlspringfollow/data/springfollow2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml (renamed from tests/auto/declarative/qmlspringfollow/data/springfollow3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp | 137 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml (renamed from tests/auto/declarative/qmlstates/data/ExtendedRectangle.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/anchorChanges.qml (renamed from tests/auto/declarative/qmlstates/data/anchorChanges.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml (renamed from tests/auto/declarative/qmlstates/data/anchorChanges2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml (renamed from tests/auto/declarative/qmlstates/data/anchorChanges3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml (renamed from tests/auto/declarative/qmlstates/data/anchorChanges4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml (renamed from tests/auto/declarative/qmlstates/data/anchorChanges5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml (renamed from tests/auto/declarative/qmlstates/data/autoStateAtStartupRestoreBug.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicBinding.qml (renamed from tests/auto/declarative/qmlstates/data/basicBinding.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml (renamed from tests/auto/declarative/qmlstates/data/basicBinding2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml (renamed from tests/auto/declarative/qmlstates/data/basicBinding3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml (renamed from tests/auto/declarative/qmlstates/data/basicBinding4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicChanges.qml (renamed from tests/auto/declarative/qmlstates/data/basicChanges.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml (renamed from tests/auto/declarative/qmlstates/data/basicChanges2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml (renamed from tests/auto/declarative/qmlstates/data/basicChanges3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml | 19 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/basicExtension.qml (renamed from tests/auto/declarative/qmlstates/data/basicExtension.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/deleting.qml (renamed from tests/auto/declarative/qmlstates/data/deleting.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/deletingState.qml (renamed from tests/auto/declarative/qmlstates/data/deletingState.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/explicit.qml (renamed from tests/auto/declarative/qmlstates/data/explicit.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml (renamed from tests/auto/declarative/qmlstates/data/fakeExtension.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml (renamed from tests/auto/declarative/qmlstates/data/illegalTempState.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/legalTempState.qml (renamed from tests/auto/declarative/qmlstates/data/legalTempState.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml (renamed from tests/auto/declarative/qmlstates/data/nonExistantProp.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange.qml (renamed from tests/auto/declarative/qmlstates/data/parentChange.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange2.qml (renamed from tests/auto/declarative/qmlstates/data/parentChange2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange3.qml (renamed from tests/auto/declarative/qmlstates/data/parentChange3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange4.qml (renamed from tests/auto/declarative/qmlstates/data/parentChange4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/parentChange5.qml (renamed from tests/auto/declarative/qmlstates/data/parentChange5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml (renamed from tests/auto/declarative/qmlstates/data/propertyErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/reset.qml | 20 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml (renamed from tests/auto/declarative/qmlstates/data/restoreEntryValues.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/script.qml (renamed from tests/auto/declarative/qmlstates/data/script.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/signalOverride.qml (renamed from tests/auto/declarative/qmlstates/data/signalOverride.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml (renamed from tests/auto/declarative/qmlstates/data/signalOverride2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml (renamed from tests/auto/declarative/qmlstates/data/signalOverrideCrash.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp | 969 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp | 96 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp | 187 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp | 844 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/cursorTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/navigation.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/navigation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml (renamed from tests/auto/declarative/qmlgraphicstextedit/data/readOnly.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp | 791 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/cursorTest.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/masks.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/masks.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/maxLength.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/navigation.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/navigation.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/readOnly.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/data/validators.qml (renamed from tests/auto/declarative/qmlgraphicstextinput/data/validators.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp | 656 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp | 285 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/bindingAssignment.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/bindingConflict.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/bindingRead.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/bindingVariantCopy.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.js (renamed from tests/auto/declarative/qmlvaluetypes/data/deletedObject.js) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/deletedObject.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/font_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/font_write.2.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/font_write.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/font_write.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/font_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/font_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/point_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/point_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/point_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/pointf_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/pointf_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/pointf_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/rect_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/rect_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/rect_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/rectf_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/rectf_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/rectf_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/scriptAccess.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/scriptVariantCopy.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/size_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/size_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/size_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/sizef_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/sizef_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/sizef_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/staticAssignment.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/valueInterceptors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/valueSources.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/vector3d_read.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_write.qml (renamed from tests/auto/declarative/qmlvaluetypes/data/vector3d_write.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp | 48 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/testtypes.h | 156 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp | 616 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/basic.html (renamed from tests/auto/declarative/qmlgraphicswebview/data/basic.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/basic.ico (renamed from tests/auto/declarative/qmlgraphicswebview/data/basic.ico) | bin | 318 -> 318 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/basic.png (renamed from tests/auto/declarative/qmlgraphicswebview/data/basic.png) | bin | 3961 -> 3961 bytes | |||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/basic.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/basic.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/elements.html (renamed from tests/auto/declarative/qmlgraphicswebview/data/elements.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/elements.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/elements.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/forward.html | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/javaScript.html (renamed from tests/auto/declarative/qmlgraphicswebview/data/javaScript.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/javaScript.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/javaScript.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/loadError.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/loadError.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/newwindows.html (renamed from tests/auto/declarative/qmlgraphicswebview/data/newwindows.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/newwindows.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/newwindows.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/pixelCache.html (renamed from tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/pixelCache.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml | 33 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/data/sethtml.qml (renamed from tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/testtypes.cpp | 52 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/testtypes.h | 66 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp | 513 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/abort.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/abort.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/abort.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/abort_opened.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/abort_unsent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/attr.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.xml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/attr.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/callbackException.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/cdata.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.xml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/cdata.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/constructor.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/defaultState.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/document.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/document.xml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/document.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/domExceptionCodes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/element.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/element.xml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/element.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_args.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_sent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_args.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_sent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_unsent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/instanceStateValues.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/invalidMethodUsage.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_invalid_method.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_network.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_network.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.wait (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_network.wait) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_sync.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_user.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/open_username.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/redirectError.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/redirectRecur.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/redirects.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/redirecttarget.html (renamed from tests/auto/declarative/qmlxmlhttprequest/data/redirecttarget.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/responseXML_invalid.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/seconddocument.html (renamed from tests/auto/declarative/qmlxmlhttprequest/data/seconddocument.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_alreadySent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.3.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.5.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.7.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_data.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_GET.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_PUT.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/send_unsent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_args.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_illegalName.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_sent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_unsent.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/staticStateValues.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/status.200.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/status.200.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/status.404.reply (renamed from tests/auto/declarative/qmlxmlhttprequest/data/status.404.reply) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect (renamed from tests/auto/declarative/qmlxmlhttprequest/data/status.expect) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/status.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/statusText.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/testdocument.html (renamed from tests/auto/declarative/qmlxmlhttprequest/data/testdocument.html) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/text.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/data/text.xml (renamed from tests/auto/declarative/qmlxmlhttprequest/data/text.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp | 1315 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml (renamed from tests/auto/declarative/qmlxmllistmodel/data/model.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/model.xml (renamed from tests/auto/declarative/qmlxmllistmodel/data/model.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml (renamed from tests/auto/declarative/qmlxmllistmodel/data/model2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml (renamed from tests/auto/declarative/qmlxmllistmodel/data/recipes.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.xml (renamed from tests/auto/declarative/qmlxmllistmodel/data/recipes.xml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml (renamed from tests/auto/declarative/qmlxmllistmodel/data/roleErrors.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml (renamed from tests/auto/declarative/qmlxmllistmodel/data/unique.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro | 11 | ||||
-rw-r--r-- | tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp | 457 | ||||
-rw-r--r-- | tests/auto/declarative/qmlanimations/qmlanimations.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp | 672 | ||||
-rw-r--r-- | tests/auto/declarative/qmlbehaviors/qmlbehaviors.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp | 301 | ||||
-rw-r--r-- | tests/auto/declarative/qmlbinding/qmlbinding.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp | 107 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/data/test-connection.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/data/test-connection2.qml | 3 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/data/test-connection3.qml | 3 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/data/trimming.qml | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/qmlconnection.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp | 139 | ||||
-rw-r--r-- | tests/auto/declarative/qmlcontext/qmlcontext.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlcontext/tst_qmlcontext.cpp | 434 | ||||
-rw-r--r-- | tests/auto/declarative/qmldatetimeformatter/qmldatetimeformatter.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmldatetimeformatter/tst_qmldatetimeformatter.cpp | 150 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebug/qmldebug.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebug/tst_qmldebug.cpp | 841 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebugclient/qmldebugclient.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp | 157 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebugservice/qmldebugservice.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp | 190 | ||||
-rw-r--r-- | tests/auto/declarative/qmldom/qmldom.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmldom/tst_qmldom.cpp | 1313 | ||||
-rw-r--r-- | tests/auto/declarative/qmleasefollow/qmleasefollow.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp | 122 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/qmlecmascript.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/testtypes.cpp | 82 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/testtypes.h | 592 | ||||
-rw-r--r-- | tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp | 1659 | ||||
-rw-r--r-- | tests/auto/declarative/qmlengine/qmlengine.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlengine/tst_qmlengine.cpp | 240 | ||||
-rw-r--r-- | tests/auto/declarative/qmlerror/qmlerror.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlerror/tst_qmlerror.cpp | 242 | ||||
-rw-r--r-- | tests/auto/declarative/qmlfontloader/qmlfontloader.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp | 156 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsanchors/qmlgraphicsanchors.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp | 459 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsanimatedimage/qmlgraphicsanimatedimage.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsanimatedimage/tst_qmlgraphicsanimatedimage.cpp | 191 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsborderimage/qmlgraphicsborderimage.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp | 351 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml | 16 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp | 224 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflipable/qmlgraphicsflipable.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp | 113 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp | 967 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsimage/qmlgraphicsimage.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp | 247 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp | 321 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicslistview/data/listview.qml | 119 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp | 1374 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsloader/data/GraphicsWidget250x250.qml | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsloader/qmlgraphicsloader.pro | 11 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp | 464 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp | 139 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsparticles/qmlgraphicsparticles.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp | 122 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicspathview/qmlgraphicspathview.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp | 491 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicspositioners/qmlgraphicspositioners.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp | 417 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsrepeater/qmlgraphicsrepeater.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp | 387 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstext/qmlgraphicstext.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp | 844 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp | 798 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextinput/qmlgraphicstextinput.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp | 663 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/data/forward.html | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/testtypes.cpp | 49 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/testtypes.h | 64 | ||||
-rw-r--r-- | tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp | 396 | ||||
-rw-r--r-- | tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro | 12 | ||||
-rw-r--r-- | tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp | 166 | ||||
-rw-r--r-- | tests/auto/declarative/qmlinfo/qmlinfo.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp | 139 | ||||
-rw-r--r-- | tests/auto/declarative/qmlinstruction/qmlinstruction.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp | 585 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/data/component.5.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/data/script.10.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/data/script.12.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/data/script.9.errors.txt | 1 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/qmllanguage.pro | 14 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/testtypes.cpp | 59 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/testtypes.h | 545 | ||||
-rw-r--r-- | tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp | 1383 | ||||
-rw-r--r-- | tests/auto/declarative/qmllist/qmllist.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmllist/tst_qmllist.cpp | 574 | ||||
-rw-r--r-- | tests/auto/declarative/qmllistmodel/qmllistmodel.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp | 338 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp | 1136 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmetatype/qmlmetatype.pro | 6 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp | 371 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp | 84 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmoduleplugin/plugin/plugin.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmoduleplugin/qmlmoduleplugin.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.cpp | 117 | ||||
-rw-r--r-- | tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.pro | 4 | ||||
-rw-r--r-- | tests/auto/declarative/qmlnumberformatter/qmlnumberformatter.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlnumberformatter/tst_qmlnumberformatter.cpp | 222 | ||||
-rw-r--r-- | tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp | 282 | ||||
-rw-r--r-- | tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp | 171 | ||||
-rw-r--r-- | tests/auto/declarative/qmlqt/qmlqt.pro | 9 | ||||
-rw-r--r-- | tests/auto/declarative/qmlqt/tst_qmlqt.cpp | 369 | ||||
-rw-r--r-- | tests/auto/declarative/qmlspringfollow/qmlspringfollow.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp | 137 | ||||
-rw-r--r-- | tests/auto/declarative/qmlstates/qmlstates.pro | 8 | ||||
-rw-r--r-- | tests/auto/declarative/qmlstates/tst_qmlstates.cpp | 911 | ||||
-rw-r--r-- | tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro | 5 | ||||
-rw-r--r-- | tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp | 187 | ||||
-rw-r--r-- | tests/auto/declarative/qmltimer/qmltimer.pro | 7 | ||||
-rw-r--r-- | tests/auto/declarative/qmltimer/tst_qmltimer.cpp | 285 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvaluetypes/qmlvaluetypes.pro | 10 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvaluetypes/testtypes.cpp | 45 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvaluetypes/testtypes.h | 152 | ||||
-rw-r--r-- | tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp | 588 | ||||
-rw-r--r-- | tests/auto/declarative/qmlxmlhttprequest/qmlxmlhttprequest.pro | 13 | ||||
-rw-r--r-- | tests/auto/declarative/qmlxmlhttprequest/tst_qmlxmlhttprequest.cpp | 1315 | ||||
-rw-r--r-- | tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro | 11 | ||||
-rw-r--r-- | tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp | 203 | ||||
-rw-r--r-- | tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp | 12 | ||||
-rw-r--r-- | tests/auto/declarative/shared/debugutil.cpp | 52 | ||||
-rw-r--r-- | tests/auto/declarative/shared/debugutil_p.h | 52 | ||||
-rw-r--r-- | tests/auto/declarative/sql/tst_sql.cpp | 18 | ||||
-rw-r--r-- | tests/auto/declarative/visual/Package_Views/packageviews.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/visual/animation/easing/easing.qml | 84 | ||||
-rw-r--r-- | tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml | 4 | ||||
-rw-r--r-- | tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml | 2 | ||||
-rw-r--r-- | tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml | 4 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/animated-smooth.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/animated-smooth.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/animated.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/animated.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/borders.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/borders.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml | 38 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/content/bw.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/content/bw.png) | bin | 1357 -> 1357 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-round.sci (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-round.sci) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-stretch.sci (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-stretch.sci) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/content/colors.png | bin | 0 -> 1655 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.0.png) | bin | 61731 -> 61731 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.1.png) | bin | 98912 -> 98912 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.2.png) | bin | 48780 -> 48780 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.3.png) | bin | 32431 -> 32431 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.4.png) | bin | 35835 -> 35835 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.5.png) | bin | 79428 -> 79428 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.6.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.6.png) | bin | 45928 -> 45928 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.0.png) | bin | 23684 -> 23684 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.1.png) | bin | 29115 -> 29115 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.2.png) | bin | 27580 -> 27580 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.3.png) | bin | 14822 -> 14822 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.4.png) | bin | 21356 -> 21356 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.5.png) | bin | 31143 -> 31143 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.6.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.6.png) | bin | 26468 -> 26468 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.7.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.7.png) | bin | 16225 -> 16225 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.0.png) | bin | 23029 -> 23029 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.1.png) | bin | 23029 -> 23029 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.2.png) | bin | 23029 -> 23029 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.3.png) | bin | 23029 -> 23029 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.4.png) | bin | 23029 -> 23029 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.qml (renamed from tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.0.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.0.png) | bin | 1305 -> 1305 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.1.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.1.png) | bin | 1306 -> 1306 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.2.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.2.png) | bin | 1305 -> 1305 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.3.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.3.png) | bin | 1303 -> 1303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.4.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.4.png) | bin | 1303 -> 1303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.5.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.5.png) | bin | 1305 -> 1305 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.6.png (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.6.png) | bin | 1306 -> 1306 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.qml (renamed from tests/auto/declarative/visual/qmleasefollow/data/easefollow.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml (renamed from tests/auto/declarative/visual/qmleasefollow/easefollow.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.0.png) | bin | 1427 -> 1427 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.1.png) | bin | 1357 -> 1357 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.2.png) | bin | 1405 -> 1405 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.3.png) | bin | 1427 -> 1427 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.qml (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.0.png) | bin | 1951 -> 1951 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.1.png) | bin | 1951 -> 1951 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.10.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.10.png) | bin | 1952 -> 1952 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.11.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.11.png) | bin | 1930 -> 1930 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.12.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.12.png) | bin | 1974 -> 1974 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.13.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.13.png) | bin | 1961 -> 1961 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.14.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.14.png) | bin | 1959 -> 1959 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.15.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.15.png) | bin | 1937 -> 1937 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.16.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.16.png) | bin | 1618 -> 1618 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.17.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.17.png) | bin | 1952 -> 1952 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.18.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.18.png) | bin | 1952 -> 1952 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.19.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.19.png) | bin | 1930 -> 1930 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.2.png) | bin | 1976 -> 1976 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.20.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.20.png) | bin | 1930 -> 1930 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.21.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.21.png) | bin | 1947 -> 1947 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.22.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.22.png) | bin | 1941 -> 1941 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.23.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.23.png) | bin | 1951 -> 1951 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.24.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.24.png) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.3.png) | bin | 1987 -> 1987 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.4.png) | bin | 1947 -> 1947 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.5.png) | bin | 1975 -> 1975 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.6.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.6.png) | bin | 1928 -> 1928 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.7.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.7.png) | bin | 1928 -> 1928 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.8.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.8.png) | bin | 1928 -> 1928 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.9.png (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.9.png) | bin | 1928 -> 1928 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.qml (renamed from tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml | 37 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml | 91 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.0.png) | bin | 1090 -> 1090 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.1.png) | bin | 1134 -> 1134 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.2.png) | bin | 961 -> 961 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.3.png) | bin | 1076 -> 1076 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.4.png) | bin | 1134 -> 1134 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.5.png) | bin | 969 -> 969 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.qml (renamed from tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeflipable/test-flipable.qml | 79 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.0.png) | bin | 1303 -> 1303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.1.png) | bin | 1317 -> 1317 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.2.png) | bin | 1318 -> 1318 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.3.png) | bin | 1306 -> 1306 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.4.png) | bin | 1308 -> 1308 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.5.png) | bin | 1303 -> 1303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.6.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.6.png) | bin | 1323 -> 1323 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.7.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.7.png) | bin | 1325 -> 1325 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.8.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.8.png) | bin | 1346 -> 1346 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.9.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.9.png) | bin | 1303 -> 1303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview.qml (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.0.png) | bin | 1310 -> 1310 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.1.png) | bin | 1322 -> 1322 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.10.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.10.png) | bin | 1313 -> 1313 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.2.png) | bin | 1341 -> 1341 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.3.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.3.png) | bin | 1368 -> 1368 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.4.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.4.png) | bin | 1319 -> 1319 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.5.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.5.png) | bin | 1352 -> 1352 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.6.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.6.png) | bin | 1309 -> 1309 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.7.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.7.png) | bin | 1347 -> 1347 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.8.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.8.png) | bin | 1310 -> 1310 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.9.png (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.9.png) | bin | 1354 -> 1354 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.qml (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/gridview.qml (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/gridview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativegridview/gridview2.qml (renamed from tests/auto/declarative/visual/qmlgraphicsgridview/gridview2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.0.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.0.png) | bin | 1563 -> 1563 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.1.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.1.png) | bin | 1570 -> 1570 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.2.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.2.png) | bin | 1553 -> 1553 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.3.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.3.png) | bin | 1563 -> 1563 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.4.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.4.png) | bin | 1569 -> 1569 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.5.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.5.png) | bin | 1569 -> 1569 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.6.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.6.png) | bin | 1566 -> 1566 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.7.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.7.png) | bin | 1566 -> 1566 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.8.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.8.png) | bin | 1567 -> 1567 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.qml (renamed from tests/auto/declarative/visual/qmlmouseregion/data/drag.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.0.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.0.png) | bin | 471 -> 471 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.1.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.1.png) | bin | 474 -> 474 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.10.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.10.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.11.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.11.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.12.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.12.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.13.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.13.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.14.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.14.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.15.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.15.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.16.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.16.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.17.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.17.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.18.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.18.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.19.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.19.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.2.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.2.png) | bin | 474 -> 474 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.20.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.20.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.21.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.21.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.22.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.22.png) | bin | 1454 -> 1454 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.3.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.3.png) | bin | 474 -> 474 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.4.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.4.png) | bin | 481 -> 481 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.5.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.5.png) | bin | 481 -> 481 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.6.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.6.png) | bin | 481 -> 481 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.7.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.7.png) | bin | 481 -> 481 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.8.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.8.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.9.png (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.9.png) | bin | 479 -> 479 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.qml (renamed from tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/drag.qml (renamed from tests/auto/declarative/visual/qmlmouseregion/drag.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativemouseregion/mouseregion.qml (renamed from tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/data/particles.0.png (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png) | bin | 10219 -> 10219 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/data/particles.1.png (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png) | bin | 13469 -> 13469 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/data/particles.2.png (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png) | bin | 14051 -> 14051 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/data/particles.qml (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/particles.qml (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativeparticles/star.png (renamed from tests/auto/declarative/visual/qmlgraphicsparticles/star.png) | bin | 262 -> 262 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.0.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.0.png) | bin | 2263 -> 2263 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.1.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.1.png) | bin | 2329 -> 2329 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.2.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.2.png) | bin | 2279 -> 2279 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.3.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.3.png) | bin | 2263 -> 2263 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.4.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.4.png) | bin | 2263 -> 2263 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.5.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.5.png) | bin | 2308 -> 2308 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.6.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.6.png) | bin | 2280 -> 2280 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.qml (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.0.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.0.png) | bin | 2321 -> 2321 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.1.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.1.png) | bin | 2380 -> 2380 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.2.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.2.png) | bin | 2315 -> 2315 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.3.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.3.png) | bin | 2372 -> 2372 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.4.png (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.4.png) | bin | 2327 -> 2327 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.qml (renamed from tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/test-pathview-2.qml (renamed from tests/auto/declarative/visual/qmlgraphicspathview/test-pathview-2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepathview/test-pathview.qml (renamed from tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.0.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.0.png) | bin | 1429 -> 1429 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.1.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.1.png) | bin | 1433 -> 1433 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.2.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.2.png) | bin | 1431 -> 1431 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.3.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.3.png) | bin | 1428 -> 1428 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.4.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.4.png) | bin | 1432 -> 1432 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.5.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.5.png) | bin | 1434 -> 1434 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.qml (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.0.png (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.0.png) | bin | 2790 -> 2790 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.qml (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/dynamic.qml (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativepositioners/repeater.qml (renamed from tests/auto/declarative/visual/qmlgraphicspositioners/repeater.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/clock.qml (renamed from tests/auto/declarative/visual/qmlspringfollow/clock.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/content/background.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/background.png) | bin | 46895 -> 46895 bytes | |||
-rwxr-xr-x | tests/auto/declarative/visual/qdeclarativespringfollow/content/center.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/center.png) | bin | 765 -> 765 bytes | |||
-rwxr-xr-x | tests/auto/declarative/visual/qdeclarativespringfollow/content/clock.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/clock.png) | bin | 20653 -> 20653 bytes | |||
-rwxr-xr-x | tests/auto/declarative/visual/qdeclarativespringfollow/content/hour.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/hour.png) | bin | 625 -> 625 bytes | |||
-rwxr-xr-x | tests/auto/declarative/visual/qdeclarativespringfollow/content/minute.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/minute.png) | bin | 625 -> 625 bytes | |||
-rwxr-xr-x | tests/auto/declarative/visual/qdeclarativespringfollow/content/second.png (renamed from tests/auto/declarative/visual/qmlspringfollow/content/second.png) | bin | 303 -> 303 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.0.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/clock.0.png) | bin | 17294 -> 17294 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.1.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/clock.1.png) | bin | 17394 -> 17394 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.2.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/clock.2.png) | bin | 17524 -> 17524 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.3.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/clock.3.png) | bin | 17572 -> 17572 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.qml (renamed from tests/auto/declarative/visual/qmlspringfollow/data/clock.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.0.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.0.png) | bin | 959 -> 959 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.1.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.1.png) | bin | 1244 -> 1244 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.10.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.10.png) | bin | 1299 -> 1299 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.2.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.2.png) | bin | 1224 -> 1224 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.3.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.3.png) | bin | 1243 -> 1243 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.4.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.4.png) | bin | 1230 -> 1230 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.5.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.5.png) | bin | 1231 -> 1231 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.6.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.6.png) | bin | 1239 -> 1239 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.7.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.7.png) | bin | 1241 -> 1241 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.8.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.8.png) | bin | 1237 -> 1237 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.9.png (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.9.png) | bin | 1229 -> 1229 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.qml (renamed from tests/auto/declarative/visual/qmlspringfollow/data/follow.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml | 71 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/baseline/data-X11/parentanchor.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/baseline/data/parentanchor.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/baseline/data/parentanchor.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/baseline/data-X11/parentanchor.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/baseline/parentanchor.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/baseline/parentanchor.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.0.png) | bin | 2276 -> 2276 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.0.png) | bin | 4818 -> 4818 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.1.png) | bin | 4089 -> 4089 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.2.png) | bin | 3128 -> 3128 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.3.png) | bin | 1963 -> 1963 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.0.png) | bin | 736 -> 736 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.0.png) | bin | 1002 -> 1002 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.0.png) | bin | 596 -> 596 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.0.png) | bin | 1604 -> 1604 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.0.png) | bin | 4818 -> 4818 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.1.png) | bin | 4089 -> 4089 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.2.png) | bin | 3128 -> 3128 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.3.png) | bin | 1963 -> 1963 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/elide.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/elide.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/elide2.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/elide/multilength.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.0.png) | bin | 103018 -> 103018 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.0.png) | bin | 136492 -> 136492 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.0.png) | bin | 94120 -> 94120 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.0.png) | bin | 121122 -> 121122 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/plaintext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/plaintext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetext/font/richtext.qml (renamed from tests/auto/declarative/visual/qmlgraphicstext/font/richtext.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml | 35 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.0.png) | bin | 793 -> 793 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.1.png) | bin | 795 -> 795 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.2.png) | bin | 803 -> 803 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.3.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.4.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.5.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.6.png) | bin | 799 -> 799 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.7.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.7.png) | bin | 799 -> 799 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.8.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.8.png) | bin | 803 -> 803 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.0.png) | bin | 365 -> 365 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.1.png) | bin | 365 -> 365 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.2.png) | bin | 366 -> 366 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.3.png) | bin | 362 -> 362 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.0.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.1.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.2.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.3.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.4.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.5.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.6.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.0.png) | bin | 3322 -> 3322 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.1.png) | bin | 3323 -> 3323 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.2.png) | bin | 3325 -> 3325 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.3.png) | bin | 3332 -> 3332 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.4.png) | bin | 3329 -> 3329 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.5.png) | bin | 3818 -> 3818 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.6.png) | bin | 3333 -> 3333 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.7.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.7.png) | bin | 3332 -> 3332 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.8.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.8.png) | bin | 3347 -> 3347 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.0.png) | bin | 4802 -> 4802 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.1.png) | bin | 4804 -> 4804 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.2.png) | bin | 4801 -> 4801 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.3.png) | bin | 4791 -> 4791 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.0.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.1.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.2.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.3.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.4.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.5.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.6.png) | bin | 1110 -> 1110 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/qt-669.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/qt-669.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextedit/wrap.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextedit/wrap.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml | 35 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.0.png) | bin | 793 -> 793 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.1.png) | bin | 796 -> 796 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.2.png) | bin | 804 -> 804 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.3.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.4.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.5.png) | bin | 805 -> 805 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.6.png) | bin | 801 -> 801 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.7.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.7.png) | bin | 802 -> 802 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.8.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.8.png) | bin | 802 -> 802 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png) | bin | 999 -> 999 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png) | bin | 1880 -> 1880 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png) | bin | 2962 -> 2962 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png) | bin | 2827 -> 2827 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png) | bin | 2827 -> 2827 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png) | bin | 1245 -> 1245 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.0.png) | bin | 3314 -> 3314 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.1.png) | bin | 3377 -> 3377 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.2.png) | bin | 3323 -> 3323 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.3.png) | bin | 3325 -> 3325 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.4.png) | bin | 3322 -> 3322 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.5.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.5.png) | bin | 3322 -> 3322 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.6.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.6.png) | bin | 3326 -> 3326 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.7.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.7.png) | bin | 3814 -> 3814 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.8.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.8.png) | bin | 3324 -> 3324 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png) | bin | 999 -> 999 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.1.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png) | bin | 1880 -> 1880 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.2.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png) | bin | 2962 -> 2962 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.3.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png) | bin | 2827 -> 2827 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.4.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png) | bin | 2827 -> 2827 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.0.png (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png) | bin | 1245 -> 1245 bytes | |||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/echoMode.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qdeclarativetextinput/hAlign.qml (renamed from tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml) | 0 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml | 38 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicsflickable/flickable-horizontal.qml | 37 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml | 91 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml | 79 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml | 35 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml | 35 | ||||
-rw-r--r-- | tests/auto/declarative/visual/qmlspringfollow/follow.qml | 71 | ||||
-rw-r--r-- | tests/auto/declarative/visual/tst_visual.cpp | 20 | ||||
-rw-r--r-- | tests/auto/qabstractproxymodel/tst_qabstractproxymodel.cpp | 82 | ||||
-rw-r--r-- | tests/auto/qdatastream/tst_qdatastream.cpp | 69 | ||||
-rw-r--r-- | tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro | 4 | ||||
-rw-r--r-- | tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp | 1200 | ||||
-rw-r--r-- | tests/auto/qdeclarativevideo/qdeclarativevideo.pro | 4 | ||||
-rw-r--r-- | tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp | 911 | ||||
-rw-r--r-- | tests/auto/qeasingcurve/tst_qeasingcurve.cpp | 61 | ||||
-rw-r--r-- | tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp | 36 | ||||
-rw-r--r-- | tests/auto/qgraphicsview/tst_qgraphicsview.cpp | 26 | ||||
-rw-r--r-- | tests/auto/qmlaudio/qmlaudio.pro | 6 | ||||
-rw-r--r-- | tests/auto/qmlaudio/tst_qmlaudio.cpp | 1200 | ||||
-rw-r--r-- | tests/auto/qmlgraphicsvideo/qmlgraphicsvideo.pro | 6 | ||||
-rw-r--r-- | tests/auto/qmlgraphicsvideo/tst_qmlgraphicsvideo.cpp | 911 | ||||
-rw-r--r-- | tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp | 29 | ||||
-rw-r--r-- | tests/auto/qscriptstring/tst_qscriptstring.cpp | 6 | ||||
-rw-r--r-- | tests/auto/qscriptvalue/qscriptvalue.pro | 7 | ||||
-rw-r--r-- | tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp | 18 | ||||
-rw-r--r-- | tests/auto/qurl/tst_qurl.cpp | 4 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt | 11963 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp | 173 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc | 5 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qdir/tree/tree.pro | 11 | ||||
-rw-r--r-- | tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro | 2 | ||||
-rw-r--r-- | tests/benchmarks/declarative/binding/binding.pro | 6 | ||||
-rw-r--r-- | tests/benchmarks/declarative/binding/testtypes.cpp | 5 | ||||
-rw-r--r-- | tests/benchmarks/declarative/binding/testtypes.h | 10 | ||||
-rw-r--r-- | tests/benchmarks/declarative/binding/tst_binding.cpp | 17 | ||||
-rw-r--r-- | tests/benchmarks/declarative/creation/creation.pro | 9 | ||||
-rw-r--r-- | tests/benchmarks/declarative/creation/tst_creation.cpp | 62 | ||||
-rw-r--r-- | tests/benchmarks/declarative/declarative.pro | 8 | ||||
-rw-r--r-- | tests/benchmarks/declarative/pointers/tst_pointers.cpp | 4 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/myqmlobject.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject_binding.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/myqmlobject_binding.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/object.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/object_id.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/BoomBlock.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStar.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStar.png) | bin | 278 -> 278 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStone.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStone.png) | bin | 2691 -> 2691 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStar.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStar.png) | bin | 273 -> 273 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStone.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStone.png) | bin | 2662 -> 2662 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStar.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStar.png) | bin | 274 -> 274 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStone.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStone.png) | bin | 2604 -> 2604 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/yellowStone.png (renamed from tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/yellowStone.png) | bin | 2667 -> 2667 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.2.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml (renamed from tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro | 19 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp | 46 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h | 83 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp | 119 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativeimage/image.png (renamed from tests/benchmarks/declarative/qmlgraphicsimage/image.png) | bin | 611 -> 611 bytes | |||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro | 16 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp | 108 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml (renamed from tests/benchmarks/declarative/qmlmetaproperty/data/object.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml (renamed from tests/benchmarks/declarative/qmlmetaproperty/data/synthesized_object.qml) | 0 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro | 8 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp | 113 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/example.qml | 14 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp | 231 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.pro | 23 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/anchors/empty.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/anchors/fill.qml | 41 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/anchors/null.qml | 27 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/children.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/data.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/no_creation.qml | 12 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/resources.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/no_positioner.qml | 37 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/null_positioner.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/positioner.qml | 37 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro | 9 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlcomponent/testtypes.cpp | 43 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlcomponent/testtypes.h | 81 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp | 118 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro | 11 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp | 102 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro | 8 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp | 113 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/example.qml | 14 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/qmltime.cpp | 219 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/qmltime.pro | 8 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml | 41 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/anchors/null.qml | 27 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml | 12 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml | 37 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml | 34 | ||||
-rw-r--r-- | tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml | 37 | ||||
-rw-r--r-- | tests/benchmarks/declarative/script/script.pro | 11 | ||||
-rw-r--r-- | tests/benchmarks/declarative/script/tst_script.cpp | 80 | ||||
-rw-r--r-- | tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp | 2 | ||||
-rw-r--r-- | tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp | 7 | ||||
-rw-r--r-- | tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp | 6 | ||||
-rw-r--r-- | tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp | 6 | ||||
-rw-r--r-- | tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp | 297 | ||||
-rw-r--r-- | tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp | 6 | ||||
-rw-r--r-- | tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp | 9 | ||||
-rw-r--r-- | tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro | 2 | ||||
-rw-r--r-- | tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp | 25 |
1416 files changed, 45477 insertions, 31561 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 5fd2dca..2ea9ca7 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -313,8 +313,6 @@ SUBDIRS += \ qmediaserviceprovider \ qmediatimerange \ qvideowidget \ - qmlaudio \ - qmlgraphicsvideo \ qspinbox \ qsplitter \ qsql \ @@ -485,6 +483,9 @@ contains(QT_CONFIG,opengl):SUBDIRS += qgl qglbuffer qgl_threads contains(QT_CONFIG,qt3support):!wince*:SUBDIRS += $$Q3SUBDIRS +contains(QT_CONFIG,multimedia):contains(QT_CONFIG,declarative):SUBDIRS += qdeclarativeaudio \ + qdeclarativevideo + contains(QT_CONFIG, OdfWriter):SUBDIRS += qzip qtextodfwriter mac: { SUBDIRS += macgui \ @@ -608,10 +609,3 @@ contains(QT_CONFIG, declarative): SUBDIRS += declarative xmlpatternsxqts \ xmlpatternsxslts - -############### make check recursively for testcases ################## -check.CONFIG = recursive -check.recurse = $$SUBDIRS -check.recurse_target = check -QMAKE_EXTRA_TARGETS += check -########################################################### diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro index 9dc7230..42ff523 100644 --- a/tests/auto/declarative/declarative.pro +++ b/tests/auto/declarative/declarative.pro @@ -4,64 +4,66 @@ SUBDIRS += \ layouts \ # Cover parserstress \ # Cover qmetaobjectbuilder \ # Cover - qmlanimations \ # Cover - qmlbehaviors \ # Cover - qmlbinding \ # Cover - qmlconnection \ # Cover - qmlcontext \ # Cover - qmldatetimeformatter \ # Cover - qmldebug \ # Cover - qmldebugclient \ # Cover - qmldebugservice \ # Cover - qmldom \ # Cover - qmleasefollow \ # Cover - qmlecmascript \ # Cover - qmlengine \ # Cover - qmlerror \ # Cover - qmlfontloader \ # Cover - qmlgraphicsanchors \ # Cover - qmlgraphicsanimatedimage \ # Cover - qmlgraphicsimage \ # Cover - qmlgraphicsborderimage \ # Cover - qmlgraphicsflickable \ # Cover - qmlgraphicsflipable \ # Cover - qmlgraphicsgridview \ # Cover - qmlgraphicsitem \ # Cover - qmlgraphicslistview \ # Cover - qmlgraphicsloader \ # Cover - qmlgraphicsmousearea \ # Cover - qmlgraphicsparticles \ # Cover - qmlgraphicspathview \ # Cover - qmlgraphicspositioners \ # Cover - qmlgraphicstext \ # Cover - qmlgraphicstextedit \ # Cover - qmlgraphicstextinput \ # Cover - qmlinfo \ # Cover - qmlinstruction \ # Cover - qmllanguage \ # Cover - qmllist \ # Cover - qmllistmodel \ # Cover - qmlmetaproperty \ # Cover - qmlmetatype \ # Cover - qmlnumberformatter \ # Cover - qmlpixmapcache \ # Cover - qmlpropertymap \ # Cover - qmlqt \ # Cover - qmlspringfollow \ # Cover - qmlstates \ # Cover - qmlsystempalette \ # Cover - qmltimer \ # Cover - qmlxmllistmodel \ # Cover + qdeclarativeanimations \ # Cover + qdeclarativebehaviors \ # Cover + qdeclarativebinding \ # Cover + qdeclarativeconnection \ # Cover + qdeclarativecontext \ # Cover + qdeclarativedatetimeformatter \ # Cover + qdeclarativedebug \ # Cover + qdeclarativedebugclient \ # Cover + qdeclarativedebugservice \ # Cover + qdeclarativedom \ # Cover + qdeclarativeeasefollow \ # Cover + qdeclarativeecmascript \ # Cover + qdeclarativeengine \ # Cover + qdeclarativeerror \ # Cover + qdeclarativefontloader \ # Cover + qdeclarativeanchors \ # Cover + qdeclarativeanimatedimage \ # Cover + qdeclarativeimage \ # Cover + qdeclarativeborderimage \ # Cover + qdeclarativeflickable \ # Cover + qdeclarativeflipable \ # Cover + qdeclarativegridview \ # Cover + qdeclarativeitem \ # Cover + qdeclarativelistview \ # Cover + qdeclarativeloader \ # Cover + qdeclarativemousearea \ # Cover + qdeclarativeparticles \ # Cover + qdeclarativepathview \ # Cover + qdeclarativepositioners \ # Cover + qdeclarativetext \ # Cover + qdeclarativetextedit \ # Cover + qdeclarativetextinput \ # Cover + qdeclarativeinfo \ # Cover + qdeclarativeinstruction \ # Cover + qdeclarativelanguage \ # Cover + qdeclarativelistreference \ # Cover + qdeclarativelistmodel \ # Cover + qdeclarativeproperty \ # Cover + qdeclarativemetatype \ # Cover + qdeclarativemoduleplugin \ # Cover + qdeclarativenumberformatter \ # Cover + qdeclarativepixmapcache \ # Cover + qdeclarativepropertymap \ # Cover + qdeclarativeqt \ # Cover + qdeclarativespringfollow \ # Cover + qdeclarativestates \ # Cover + qdeclarativesystempalette \ # Cover + qdeclarativetimer \ # Cover + qdeclarativexmllistmodel \ # Cover qpacketprotocol \ # Cover - qmlgraphicsrepeater \ # Cover - qmlvaluetypes \ # Cover - qmlxmlhttprequest \ # Cover - qmlimageprovider \ # Cover + qdeclarativerepeater \ # Cover + qdeclarativevaluetypes \ # Cover + qdeclarativexmlhttprequest \ # Cover + qdeclarativeimageprovider \ # Cover + qdeclarativestyledtext \ # Cover sql # Cover contains(QT_CONFIG, webkit) { SUBDIRS += \ - qmlgraphicswebview # Cover + qdeclarativewebview # Cover } # Tests which should run in Pulse diff --git a/tests/auto/declarative/examples/tst_examples.cpp b/tests/auto/declarative/examples/tst_examples.cpp index 104c2d3..6160e7c 100644 --- a/tests/auto/declarative/examples/tst_examples.cpp +++ b/tests/auto/declarative/examples/tst_examples.cpp @@ -56,7 +56,7 @@ private slots: void namingConvention(); private: - QString qmlviewer; + QString qmlruntime; QStringList excludedDirs; void namingConvention(const QDir &); @@ -68,11 +68,11 @@ tst_examples::tst_examples() QString binaries = QLibraryInfo::location(QLibraryInfo::BinariesPath); #if defined(Q_WS_MAC) - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer.app/Contents/MacOS/qmlviewer"); + qmlruntime = QDir(binaries).absoluteFilePath("qml.app/Contents/MacOS/qml"); #elif defined(Q_WS_WIN) - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer.exe"); + qmlruntime = QDir(binaries).absoluteFilePath("qml.exe"); #else - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer"); + qmlruntime = QDir(binaries).absoluteFilePath("qml"); #endif @@ -190,7 +190,8 @@ void tst_examples::examples() << "-scriptopts" << "play,testerror,exitoncomplete,exitonfailure" << file; QProcess p; - p.start(qmlviewer, arguments); +qDebug() << qmlruntime << arguments; + p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); QCOMPARE(p.exitStatus(), QProcess::NormalExit); QCOMPARE(p.exitCode(), 0); diff --git a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml index 70fafd6..c00173d 100644 --- a/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml +++ b/tests/auto/declarative/graphicswidgets/data/graphicswidgets.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 QGraphicsView { objectName: "GView" diff --git a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp index cb618c6..a85ceed 100644 --- a/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp +++ b/tests/auto/declarative/graphicswidgets/tst_graphicswidgets.cpp @@ -40,9 +40,9 @@ ****************************************************************************/ #include <qtest.h> #include <QFile> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/graphicswidgets_p.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtGui/qgraphicsview.h> class tst_graphicswidgets : public QObject @@ -61,8 +61,8 @@ tst_graphicswidgets::tst_graphicswidgets() void tst_graphicswidgets::widgets() { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/graphicswidgets.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/graphicswidgets.qml")); QGraphicsView *obj = qobject_cast<QGraphicsView*>(c.create()); QVERIFY(obj != 0); diff --git a/tests/auto/declarative/layouts/data/layouts.qml b/tests/auto/declarative/layouts/data/layouts.qml index 00d785d..1792500 100644 --- a/tests/auto/declarative/layouts/data/layouts.qml +++ b/tests/auto/declarative/layouts/data/layouts.qml @@ -1,4 +1,5 @@ import Qt 4.6 +import Qt.widgets 4.6 Item { id: resizable diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp index ee05574..942125f 100644 --- a/tests/auto/declarative/layouts/tst_layouts.cpp +++ b/tests/auto/declarative/layouts/tst_layouts.cpp @@ -40,39 +40,38 @@ ****************************************************************************/ #include <QtTest/QtTest> #include <private/qlistmodelinterface_p.h> -#include <qmlview.h> -#include <private/qmlgraphicslayoutitem_p.h> -#include <qmlexpression.h> +#include <qdeclarativeview.h> +#include <private/qdeclarativelayoutitem_p.h> +#include <qdeclarativeexpression.h> #include <QStyle> -class tst_QmlGraphicsLayouts : public QObject +class tst_QDeclarativeLayouts : public QObject { Q_OBJECT public: - tst_QmlGraphicsLayouts(); + tst_QDeclarativeLayouts(); private slots: void test_qml();//GraphicsLayout set up in Qml void test_cpp();//GraphicsLayout set up in C++ private: - QmlView *createView(const QString &filename); + QDeclarativeView *createView(const QString &filename); }; -tst_QmlGraphicsLayouts::tst_QmlGraphicsLayouts() +tst_QDeclarativeLayouts::tst_QDeclarativeLayouts() { } -void tst_QmlGraphicsLayouts::test_qml() +void tst_QDeclarativeLayouts::test_qml() { - QmlView *canvas = createView(SRCDIR "/data/layouts.qml"); + QDeclarativeView *canvas = createView(SRCDIR "/data/layouts.qml"); - canvas->execute(); qApp->processEvents(); - QmlGraphicsLayoutItem *left = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("left")); + QDeclarativeLayoutItem *left = static_cast<QDeclarativeLayoutItem*>(canvas->rootObject()->findChild<QDeclarativeItem*>("left")); QVERIFY(left != 0); - QmlGraphicsLayoutItem *right = static_cast<QmlGraphicsLayoutItem*>(canvas->rootObject()->findChild<QmlGraphicsItem*>("right")); + QDeclarativeLayoutItem *right = static_cast<QDeclarativeLayoutItem*>(canvas->rootObject()->findChild<QDeclarativeItem*>("right")); QVERIFY(right != 0); qreal l = QApplication::style()->pixelMetric(QStyle::PM_LayoutLeftMargin); @@ -82,7 +81,7 @@ void tst_QmlGraphicsLayouts::test_qml() QVERIFY2(l == r && r == t && t == b, "Test assumes equal margins."); qreal gvMargin = l; - QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(canvas->rootObject()); + QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject()); QVERIFY(rootItem != 0); //Preferred Size @@ -129,20 +128,20 @@ void tst_QmlGraphicsLayouts::test_qml() delete canvas; } -void tst_QmlGraphicsLayouts::test_cpp() +void tst_QDeclarativeLayouts::test_cpp() { //TODO: Waiting on QT-2407 to write this test } -QmlView *tst_QmlGraphicsLayouts::createView(const QString &filename) +QDeclarativeView *tst_QDeclarativeLayouts::createView(const QString &filename) { - QmlView *canvas = new QmlView(0); + QDeclarativeView *canvas = new QDeclarativeView(0); canvas->setSource(QUrl::fromLocalFile(filename)); return canvas; } -QTEST_MAIN(tst_QmlGraphicsLayouts) +QTEST_MAIN(tst_QDeclarativeLayouts) #include "tst_layouts.moc" diff --git a/tests/auto/declarative/parserstress/tst_parserstress.cpp b/tests/auto/declarative/parserstress/tst_parserstress.cpp index 8af1b12..6ff5515 100644 --- a/tests/auto/declarative/parserstress/tst_parserstress.cpp +++ b/tests/auto/declarative/parserstress/tst_parserstress.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <qtest.h> -#include <QmlEngine> -#include <QmlComponent> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> #include <QDebug> #include <QDir> #include <QFile> @@ -58,7 +58,7 @@ private slots: private: static QStringList findJSFiles(const QDir &); - QmlEngine engine; + QDeclarativeEngine engine; }; QStringList tst_parserstress::findJSFiles(const QDir &d) @@ -130,7 +130,7 @@ void tst_parserstress::ecmascript() QByteArray qmlData = qml.toUtf8(); - QmlComponent component(&engine); + QDeclarativeComponent component(&engine); component.setData(qmlData, QUrl::fromLocalFile(SRCDIR + QString("/dummy.qml"))); QSet<QString> failingTests; failingTests << "uc-003.js" << "uc-005.js" << "regress-352044-02-n.js" diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/anchors.qml b/tests/auto/declarative/qdeclarativeanchors/data/anchors.qml index b64d0b0..b64d0b0 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/anchors.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/anchors.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/centerin.qml b/tests/auto/declarative/qdeclarativeanchors/data/centerin.qml index 09b97f6..09b97f6 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/centerin.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/centerin.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/crash1.qml b/tests/auto/declarative/qdeclarativeanchors/data/crash1.qml index fd9dc55..fd9dc55 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/crash1.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/crash1.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/fill.qml b/tests/auto/declarative/qdeclarativeanchors/data/fill.qml index 902465c..902465c 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/fill.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/fill.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/loop1.qml b/tests/auto/declarative/qdeclarativeanchors/data/loop1.qml index a266612..a266612 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/loop1.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/loop1.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/loop2.qml b/tests/auto/declarative/qdeclarativeanchors/data/loop2.qml index acb57cd..acb57cd 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/loop2.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/loop2.qml diff --git a/tests/auto/declarative/qmlgraphicsanchors/data/margins.qml b/tests/auto/declarative/qdeclarativeanchors/data/margins.qml index 4a29e77..4a29e77 100644 --- a/tests/auto/declarative/qmlgraphicsanchors/data/margins.qml +++ b/tests/auto/declarative/qdeclarativeanchors/data/margins.qml diff --git a/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro new file mode 100644 index 0000000..ca2f68f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/qdeclarativeanchors.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativeanchors.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp new file mode 100644 index 0000000..9d8ba6c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanchors/tst_qdeclarativeanchors.cpp @@ -0,0 +1,448 @@ +/**************************************************************************** +** +** 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 <QSignalSpy> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativetext_p.h> +#include <QtDeclarative/private/qdeclarativeanchors_p_p.h> + +Q_DECLARE_METATYPE(QDeclarativeAnchors::UsedAnchor) +Q_DECLARE_METATYPE(QDeclarativeAnchorLine::AnchorLine) + + +class tst_qdeclarativeanchors : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeanchors() {} + + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &id); + +private slots: + void basicAnchors(); + void loops(); + void illegalSets(); + void illegalSets_data(); + void reset(); + void reset_data(); + void resetConvenience(); + void nullItem(); + void nullItem_data(); + void crash1(); + void centerIn(); + void fill(); + void margins(); +}; + +/* + Find an item with the specified id. +*/ +template<typename T> +T *tst_qdeclarativeanchors::findItem(QGraphicsObject *parent, const QString &objectName) +{ + const QMetaObject &mo = T::staticMetaObject; + QList<QGraphicsItem *> children = parent->childItems(); + for (int i = 0; i < children.count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(children.at(i)->toGraphicsObject()); + if (item) { + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + return static_cast<T*>(item); + } + item = findItem<T>(item, objectName); + if (item) + return static_cast<T*>(item); + } + } + + return 0; +} + +void tst_qdeclarativeanchors::basicAnchors() +{ + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); + + qApp->processEvents(); + + //sibling horizontal + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect1"))->x(), 26.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect2"))->x(), 122.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect3"))->x(), 74.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect4"))->x(), 16.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect5"))->x(), 112.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect6"))->x(), 64.0); + + //parent horizontal + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect7"))->x(), 0.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect8"))->x(), 240.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect9"))->x(), 120.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect10"))->x(), -10.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect11"))->x(), 230.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect12"))->x(), 110.0); + + //vertical + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect13"))->y(), 20.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect14"))->y(), 155.0); + + //stretch + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect15"))->x(), 26.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect15"))->width(), 96.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect16"))->x(), 26.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect16"))->width(), 192.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect17"))->x(), -70.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect17"))->width(), 192.0); + + //vertical stretch + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect18"))->y(), 20.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect18"))->height(), 40.0); + + //more parent horizontal + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect19"))->x(), 115.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect20"))->x(), 235.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect21"))->x(), -5.0); + + //centerIn + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect22"))->x(), 69.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect22"))->y(), 5.0); + + //margins + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect23"))->x(), 31.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect23"))->y(), 5.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect23"))->width(), 86.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect23"))->height(), 10.0); + + // offsets + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect24"))->x(), 26.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect25"))->y(), 60.0); + QCOMPARE(findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("rect26"))->y(), 5.0); + + //baseline + QDeclarativeText *text1 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text1")); + QDeclarativeText *text2 = findItem<QDeclarativeText>(view->rootObject(), QLatin1String("text2")); + QCOMPARE(text1->y(), text2->y()); + + delete view; +} + +// mostly testing that we don't crash +void tst_qdeclarativeanchors::loops() +{ + { + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); + + QString expect = "QML Text (" + source.toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + + QDeclarativeView *view = new QDeclarativeView; + view->setSource(source); + qApp->processEvents(); + + delete view; + } + + { + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); + + QString expect = "QML Image (" + source.toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + + QDeclarativeView *view = new QDeclarativeView; + view->setSource(source); + qApp->processEvents(); + + delete view; + } +} + +void tst_qdeclarativeanchors::illegalSets() +{ + QFETCH(QString, qml); + QFETCH(QString, warning); + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); + if (!component.isReady()) + qWarning() << "Test errors:" << component.errors(); + QVERIFY(component.isReady()); + QObject *o = component.create(); + delete o; +} + +void tst_qdeclarativeanchors::illegalSets_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("warning"); + + QTest::newRow("H - too many anchors") + << "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }" + << "QML Rectangle (file::2:23) Cannot specify left, right, and hcenter anchors."; + + foreach (const QString &side, QStringList() << "left" << "right") { + QTest::newRow("H - anchor to V") + << QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side) + << "QML Rectangle (file::2:13) Cannot anchor a horizontal edge to a vertical edge."; + + QTest::newRow("H - anchor to non parent/sibling") + << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) + << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; + + QTest::newRow("H - anchor to self") + << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) + << "QML Rectangle (file::2:1) Cannot anchor item to self."; + } + + + QTest::newRow("V - too many anchors") + << "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }" + << "QML Rectangle (file::2:23) Cannot specify top, bottom, and vcenter anchors."; + + QTest::newRow("V - too many anchors with baseline") + << "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }" + << "QML Text (file::2:47) Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors."; + + foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") { + + QTest::newRow("V - anchor to H") + << QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side) + << "QML Rectangle (file::2:13) Cannot anchor a vertical edge to a horizontal edge."; + + QTest::newRow("V - anchor to non parent/sibling") + << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) + << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; + + QTest::newRow("V - anchor to self") + << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) + << "QML Rectangle (file::2:1) Cannot anchor item to self."; + } + + + QTest::newRow("centerIn - anchor to non parent/sibling") + << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }" + << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; + + + QTest::newRow("fill - anchor to non parent/sibling") + << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }" + << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; +} + +void tst_qdeclarativeanchors::reset() +{ + QFETCH(QString, side); + QFETCH(QDeclarativeAnchorLine::AnchorLine, anchorLine); + QFETCH(QDeclarativeAnchors::UsedAnchor, usedAnchor); + + QDeclarativeItem *baseItem = new QDeclarativeItem; + + QDeclarativeAnchorLine anchor; + anchor.item = baseItem; + anchor.anchorLine = anchorLine; + + QDeclarativeItem *item = new QDeclarativeItem; + + const QMetaObject *meta = item->anchors()->metaObject(); + QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); + + QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); + QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), true); + + QVERIFY(p.reset(item->anchors())); + QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), false); + + delete item; + delete baseItem; +} + +void tst_qdeclarativeanchors::reset_data() +{ + QTest::addColumn<QString>("side"); + QTest::addColumn<QDeclarativeAnchorLine::AnchorLine>("anchorLine"); + QTest::addColumn<QDeclarativeAnchors::UsedAnchor>("usedAnchor"); + + QTest::newRow("left") << "left" << QDeclarativeAnchorLine::Left << QDeclarativeAnchors::HasLeftAnchor; + QTest::newRow("top") << "top" << QDeclarativeAnchorLine::Top << QDeclarativeAnchors::HasTopAnchor; + QTest::newRow("right") << "right" << QDeclarativeAnchorLine::Right << QDeclarativeAnchors::HasRightAnchor; + QTest::newRow("bottom") << "bottom" << QDeclarativeAnchorLine::Bottom << QDeclarativeAnchors::HasBottomAnchor; + + QTest::newRow("hcenter") << "horizontalCenter" << QDeclarativeAnchorLine::HCenter << QDeclarativeAnchors::HasHCenterAnchor; + QTest::newRow("vcenter") << "verticalCenter" << QDeclarativeAnchorLine::VCenter << QDeclarativeAnchors::HasVCenterAnchor; + QTest::newRow("baseline") << "baseline" << QDeclarativeAnchorLine::Baseline << QDeclarativeAnchors::HasBaselineAnchor; +} + +void tst_qdeclarativeanchors::resetConvenience() +{ + QDeclarativeItem *baseItem = new QDeclarativeItem; + QDeclarativeItem *item = new QDeclarativeItem; + + //fill + item->anchors()->setFill(baseItem); + QVERIFY(item->anchors()->fill() == baseItem); + item->anchors()->resetFill(); + QVERIFY(item->anchors()->fill() == 0); + + //centerIn + item->anchors()->setCenterIn(baseItem); + QVERIFY(item->anchors()->centerIn() == baseItem); + item->anchors()->resetCenterIn(); + QVERIFY(item->anchors()->centerIn() == 0); + + delete item; + delete baseItem; +} + +void tst_qdeclarativeanchors::nullItem() +{ + QFETCH(QString, side); + + QDeclarativeAnchorLine anchor; + QDeclarativeItem *item = new QDeclarativeItem; + + const QMetaObject *meta = item->anchors()->metaObject(); + QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); + + QTest::ignoreMessage(QtWarningMsg, "QML Item (unknown location) Cannot anchor to a null item."); + QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); + + delete item; +} + +void tst_qdeclarativeanchors::nullItem_data() +{ + QTest::addColumn<QString>("side"); + + QTest::newRow("left") << "left"; + QTest::newRow("top") << "top"; + QTest::newRow("right") << "right"; + QTest::newRow("bottom") << "bottom"; + + QTest::newRow("hcenter") << "horizontalCenter"; + QTest::newRow("vcenter") << "verticalCenter"; + QTest::newRow("baseline") << "baseline"; +} + +void tst_qdeclarativeanchors::crash1() +{ + QUrl source(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); + + QString expect = "QML Text (" + source.toString() + ":4:5" + ") Possible anchor loop detected on fill."; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message + + QDeclarativeView *view = new QDeclarativeView(source); + qApp->processEvents(); + + delete view; +} + +void tst_qdeclarativeanchors::fill() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("filler")); + QCOMPARE(rect->x(), 0.0 + 10.0); + QCOMPARE(rect->y(), 0.0 + 30.0); + QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0); + //Alter Offsets (QTBUG-6631) + rect->anchors()->setLeftMargin(20.0); + rect->anchors()->setRightMargin(0.0); + rect->anchors()->setBottomMargin(0.0); + rect->anchors()->setTopMargin(10.0); + QCOMPARE(rect->x(), 0.0 + 20.0); + QCOMPARE(rect->y(), 0.0 + 10.0); + QCOMPARE(rect->width(), 200.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 10.0); + + delete view; +} + +void tst_qdeclarativeanchors::centerIn() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("centered")); + QCOMPARE(rect->x(), 75.0 + 10); + QCOMPARE(rect->y(), 75.0 + 30); + //Alter Offsets (QTBUG-6631) + rect->anchors()->setHorizontalCenterOffset(-20.0); + rect->anchors()->setVerticalCenterOffset(-10.0); + QCOMPARE(rect->x(), 75.0 - 20.0); + QCOMPARE(rect->y(), 75.0 - 10.0); + + delete view; +} + +void tst_qdeclarativeanchors::margins() +{ + QDeclarativeView *view = new QDeclarativeView(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); + + qApp->processEvents(); + QDeclarativeRectangle* rect = findItem<QDeclarativeRectangle>(view->rootObject(), QLatin1String("filler")); + QCOMPARE(rect->x(), 5.0); + QCOMPARE(rect->y(), 6.0); + QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0); + QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0); + + rect->anchors()->setTopMargin(0.0); + rect->anchors()->setMargins(20.0); + + QCOMPARE(rect->x(), 5.0); + QCOMPARE(rect->y(), 20.0); + QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0); + QCOMPARE(rect->height(), 200.0 - 20.0 - 20.0); + + delete view; +} + +QTEST_MAIN(tst_qdeclarativeanchors) + +#include "tst_qdeclarativeanchors.moc" diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.gif b/tests/auto/declarative/qdeclarativeanimatedimage/data/colors.gif Binary files differindex 1270bfa..1270bfa 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.gif +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/colors.gif diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/colors.qml index 5bada34..5bada34 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/colors.qml +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/colors.qml diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.gif b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.gif Binary files differindex 7c4cd18..7c4cd18 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.gif +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.gif diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.qml index a70db5d..a70db5d 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickman.qml +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickman.qml diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanpause.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanpause.qml index 7ab17d4..7ab17d4 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanpause.qml +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanpause.qml diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanstopped.qml b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanstopped.qml index 53b0c3a..53b0c3a 100644 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/data/stickmanstopped.qml +++ b/tests/auto/declarative/qdeclarativeanimatedimage/data/stickmanstopped.qml diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro new file mode 100644 index 0000000..2904986 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/qdeclarativeanimatedimage.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative network +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativeanimatedimage.cpp ../shared/testhttpserver.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp new file mode 100644 index 0000000..31efc64 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimatedimage/tst_qdeclarativeanimatedimage.cpp @@ -0,0 +1,191 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativeimage_p.h> +#include <private/qdeclarativeanimatedimage_p.h> + +#include "../shared/testhttpserver.h" + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 6; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + + +class tst_qdeclarativeanimatedimage : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeanimatedimage() {} + +private slots: + void play(); + void pause(); + void stopped(); + void setFrame(); + void frameCount(); + void remote(); + void remote_data(); + void invalidSource(); +}; + +void tst_qdeclarativeanimatedimage::play() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickman.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(anim->isPlaying()); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::pause() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(anim->isPlaying()); + QVERIFY(anim->isPaused()); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::stopped() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(!anim->isPlaying()); + QCOMPARE(anim->currentFrame(), 0); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::setFrame() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(anim->isPlaying()); + QCOMPARE(anim->currentFrame(), 2); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::frameCount() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/colors.qml")); + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + QVERIFY(anim->isPlaying()); + QCOMPARE(anim->frameCount(), 3); + + delete anim; +} + +void tst_qdeclarativeanimatedimage::remote() +{ + QFETCH(QString, fileName); + QFETCH(bool, paused); + + TestHTTPServer server(14445); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, QUrl("http://127.0.0.1:14445/" + fileName)); + TRY_WAIT(component.isReady()); + + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + + TRY_WAIT(anim->isPlaying()); + if (paused) { + TRY_WAIT(anim->isPaused()); + QCOMPARE(anim->currentFrame(), 2); + } + + delete anim; +} + +void tst_qdeclarativeanimatedimage::remote_data() +{ + QTest::addColumn<QString>("fileName"); + QTest::addColumn<bool>("paused"); + + QTest::newRow("playing") << "stickman.qml" << false; + QTest::newRow("paused") << "stickmanpause.qml" << true; +} + +void tst_qdeclarativeanimatedimage::invalidSource() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); + QVERIFY(component.isReady()); + + QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); + + QDeclarativeAnimatedImage *anim = qobject_cast<QDeclarativeAnimatedImage *>(component.create()); + QVERIFY(anim); + + QVERIFY(!anim->isPlaying()); + QVERIFY(!anim->isPaused()); + QCOMPARE(anim->currentFrame(), 0); + QCOMPARE(anim->frameCount(), 0); +} + +QTEST_MAIN(tst_qdeclarativeanimatedimage) + +#include "tst_qdeclarativeanimatedimage.moc" diff --git a/tests/auto/declarative/qmlanimations/data/attached.qml b/tests/auto/declarative/qdeclarativeanimations/data/attached.qml index 0fb6f8c..0fb6f8c 100644 --- a/tests/auto/declarative/qmlanimations/data/attached.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/attached.qml diff --git a/tests/auto/declarative/qmlanimations/data/badproperty1.qml b/tests/auto/declarative/qdeclarativeanimations/data/badproperty1.qml index d31cae9..d31cae9 100644 --- a/tests/auto/declarative/qmlanimations/data/badproperty1.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badproperty1.qml diff --git a/tests/auto/declarative/qmlanimations/data/badproperty2.qml b/tests/auto/declarative/qdeclarativeanimations/data/badproperty2.qml index 3b8b111..3b8b111 100644 --- a/tests/auto/declarative/qmlanimations/data/badproperty2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badproperty2.qml diff --git a/tests/auto/declarative/qmlanimations/data/badtype1.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml index 6381df3..6381df3 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype1.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype1.qml diff --git a/tests/auto/declarative/qmlanimations/data/badtype2.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml index 8d57e41..8d57e41 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype2.qml diff --git a/tests/auto/declarative/qmlanimations/data/badtype3.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml index c4867c3..c4867c3 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype3.qml diff --git a/tests/auto/declarative/qmlanimations/data/badtype4.qml b/tests/auto/declarative/qdeclarativeanimations/data/badtype4.qml index e80762f..e80762f 100644 --- a/tests/auto/declarative/qmlanimations/data/badtype4.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/badtype4.qml diff --git a/tests/auto/declarative/qmlanimations/data/dontAutoStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml index d9660b6..d9660b6 100644 --- a/tests/auto/declarative/qmlanimations/data/dontAutoStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontAutoStart.qml diff --git a/tests/auto/declarative/qmlanimations/data/dontStart.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml index 36417db..36417db 100644 --- a/tests/auto/declarative/qmlanimations/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontStart.qml diff --git a/tests/auto/declarative/qmlanimations/data/dontStart2.qml b/tests/auto/declarative/qdeclarativeanimations/data/dontStart2.qml index 1a6540f..1a6540f 100644 --- a/tests/auto/declarative/qmlanimations/data/dontStart2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dontStart2.qml diff --git a/tests/auto/declarative/qmlanimations/data/dotproperty.qml b/tests/auto/declarative/qdeclarativeanimations/data/dotproperty.qml index 9f0e699..9f0e699 100644 --- a/tests/auto/declarative/qmlanimations/data/dotproperty.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/dotproperty.qml diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml b/tests/auto/declarative/qdeclarativeanimations/data/mixedtype1.qml index 6770366..6770366 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype1.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/mixedtype1.qml diff --git a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml b/tests/auto/declarative/qdeclarativeanimations/data/mixedtype2.qml index 80c9473..80c9473 100644 --- a/tests/auto/declarative/qmlanimations/data/mixedtype2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/mixedtype2.qml diff --git a/tests/auto/declarative/qmlanimations/data/properties.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml index 7e73f57..7e73f57 100644 --- a/tests/auto/declarative/qmlanimations/data/properties.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties.qml diff --git a/tests/auto/declarative/qmlanimations/data/properties2.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml index 6c96155..6c96155 100644 --- a/tests/auto/declarative/qmlanimations/data/properties2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties2.qml diff --git a/tests/auto/declarative/qmlanimations/data/properties3.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml index ff08885..ff08885 100644 --- a/tests/auto/declarative/qmlanimations/data/properties3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties3.qml diff --git a/tests/auto/declarative/qmlanimations/data/properties4.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml index dab7e5f..dab7e5f 100644 --- a/tests/auto/declarative/qmlanimations/data/properties4.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties4.qml diff --git a/tests/auto/declarative/qmlanimations/data/properties5.qml b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml index 38396b1..38396b1 100644 --- a/tests/auto/declarative/qmlanimations/data/properties5.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/properties5.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition.qml index b13b94b..b13b94b 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition2.qml index 033c5c1..033c5c1 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition2.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition3.qml index d0704c9..d0704c9 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition3.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition3.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition4.qml index e70c95c..e70c95c 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition4.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition4.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition5.qml index b9e27da..b9e27da 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition5.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition5.qml diff --git a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition6.qml index 7417ed1..7417ed1 100644 --- a/tests/auto/declarative/qmlanimations/data/propertiesTransition6.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/propertiesTransition6.qml diff --git a/tests/auto/declarative/qmlanimations/data/valuesource.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml index c35063d..c35063d 100644 --- a/tests/auto/declarative/qmlanimations/data/valuesource.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource.qml diff --git a/tests/auto/declarative/qmlanimations/data/valuesource2.qml b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml index 1a60542..1a60542 100644 --- a/tests/auto/declarative/qmlanimations/data/valuesource2.qml +++ b/tests/auto/declarative/qdeclarativeanimations/data/valuesource2.qml diff --git a/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro new file mode 100644 index 0000000..8eac75f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/qdeclarativeanimations.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativeanimations.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp new file mode 100644 index 0000000..53c63b5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeanimations/tst_qdeclarativeanimations.cpp @@ -0,0 +1,672 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativeanimation_p.h> +#include <QVariantAnimation> +#include <QEasingCurve> + +class tst_qdeclarativeanimations : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeanimations() {} + +private slots: + void initTestCase() { QDeclarativeEngine engine; } // ensure types are registered + + void simpleProperty(); + void simpleNumber(); + void simpleColor(); + void alwaysRunToEnd(); + void complete(); + void resume(); + void dotProperty(); + void badTypes(); + void badProperties(); + void mixedTypes(); + void properties(); + void propertiesTransition(); + void invalidDuration(); + void attached(); + void propertyValueSourceDefaultStart(); + void dontStart(); + void easingProperties(); +}; + +#define QTIMED_COMPARE(lhs, rhs) do { \ + for (int ii = 0; ii < 5; ++ii) { \ + if (lhs == rhs) \ + break; \ + QTest::qWait(50); \ + } \ + QCOMPARE(lhs, rhs); \ +} while (false) + +void tst_qdeclarativeanimations::simpleProperty() +{ + QDeclarativeRectangle rect; + QDeclarativePropertyAnimation animation; + animation.setTarget(&rect); + animation.setProperty("pos"); + animation.setTo(QPointF(200,200)); + QVERIFY(animation.target() == &rect); + QVERIFY(animation.property() == "pos"); + QVERIFY(animation.to().toPointF() == QPointF(200,200)); + animation.start(); + QVERIFY(animation.isRunning()); + QTest::qWait(animation.duration()); + QTIMED_COMPARE(rect.pos(), QPointF(200,200)); + + rect.setPos(0,0); + animation.start(); + animation.pause(); + QVERIFY(animation.isRunning()); + QVERIFY(animation.isPaused()); + animation.setCurrentTime(125); + QVERIFY(animation.currentTime() == 125); + QCOMPARE(rect.pos(), QPointF(100,100)); +} + +void tst_qdeclarativeanimations::simpleNumber() +{ + QDeclarativeRectangle rect; + QDeclarativeNumberAnimation animation; + animation.setTarget(&rect); + animation.setProperty("x"); + animation.setTo(200); + QVERIFY(animation.target() == &rect); + QVERIFY(animation.property() == "x"); + QVERIFY(animation.to() == 200); + animation.start(); + QVERIFY(animation.isRunning()); + QTest::qWait(animation.duration()); + QTIMED_COMPARE(rect.x(), qreal(200)); + + rect.setX(0); + animation.start(); + animation.pause(); + QVERIFY(animation.isRunning()); + QVERIFY(animation.isPaused()); + animation.setCurrentTime(125); + QVERIFY(animation.currentTime() == 125); + QCOMPARE(rect.x(), qreal(100)); +} + +void tst_qdeclarativeanimations::simpleColor() +{ + QDeclarativeRectangle rect; + QDeclarativeColorAnimation animation; + animation.setTarget(&rect); + animation.setProperty("color"); + animation.setTo(QColor("red")); + QVERIFY(animation.target() == &rect); + QVERIFY(animation.property() == "color"); + QVERIFY(animation.to() == QColor("red")); + animation.start(); + QVERIFY(animation.isRunning()); + QTest::qWait(animation.duration()); + QTIMED_COMPARE(rect.color(), QColor("red")); + + rect.setColor(QColor("blue")); + animation.start(); + animation.pause(); + QVERIFY(animation.isRunning()); + QVERIFY(animation.isPaused()); + animation.setCurrentTime(125); + QVERIFY(animation.currentTime() == 125); + QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); + + rect.setColor(QColor("green")); + animation.setFrom(QColor("blue")); + QVERIFY(animation.from() == QColor("blue")); + animation.restart(); + QCOMPARE(rect.color(), QColor("blue")); + QVERIFY(animation.isRunning()); + animation.setCurrentTime(125); + QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); +} + +void tst_qdeclarativeanimations::alwaysRunToEnd() +{ + QDeclarativeRectangle rect; + QDeclarativePropertyAnimation animation; + animation.setTarget(&rect); + animation.setProperty("x"); + animation.setTo(200); + animation.setDuration(1000); + animation.setRepeat(true); + animation.setAlwaysRunToEnd(true); + QVERIFY(animation.repeat() == true); + QVERIFY(animation.alwaysRunToEnd() == true); + animation.start(); + QTest::qWait(1500); + animation.stop(); + QVERIFY(rect.x() != qreal(200)); + QTest::qWait(500); + QTIMED_COMPARE(rect.x(), qreal(200)); +} + +void tst_qdeclarativeanimations::complete() +{ + QDeclarativeRectangle rect; + QDeclarativePropertyAnimation animation; + animation.setTarget(&rect); + animation.setProperty("x"); + animation.setFrom(1); + animation.setTo(200); + animation.setDuration(500); + QVERIFY(animation.from() == 1); + animation.start(); + QTest::qWait(50); + animation.stop(); + QVERIFY(rect.x() != qreal(200)); + animation.start(); + QTest::qWait(50); + QVERIFY(animation.isRunning()); + animation.complete(); + QCOMPARE(rect.x(), qreal(200)); +} + +void tst_qdeclarativeanimations::resume() +{ + QDeclarativeRectangle rect; + QDeclarativePropertyAnimation animation; + animation.setTarget(&rect); + animation.setProperty("x"); + animation.setFrom(10); + animation.setTo(200); + animation.setDuration(500); + QVERIFY(animation.from() == 10); + + animation.start(); + QTest::qWait(100); + animation.pause(); + qreal x = rect.x(); + QVERIFY(x != qreal(200)); + QVERIFY(animation.isRunning()); + QVERIFY(animation.isPaused()); + + animation.resume(); + QVERIFY(animation.isRunning()); + QVERIFY(!animation.isPaused()); + QTest::qWait(100); + animation.stop(); + QVERIFY(rect.x() > x); +} + +void tst_qdeclarativeanimations::dotProperty() +{ + QDeclarativeRectangle rect; + QDeclarativeNumberAnimation animation; + animation.setTarget(&rect); + animation.setProperty("border.width"); + animation.setTo(10); + animation.start(); + QTest::qWait(animation.duration()+50); + QTIMED_COMPARE(rect.border()->width(), 10); + + rect.border()->setWidth(0); + animation.start(); + animation.pause(); + animation.setCurrentTime(125); + QVERIFY(animation.currentTime() == 125); + QCOMPARE(rect.border()->width(), 5); +} + +void tst_qdeclarativeanimations::badTypes() +{ + //don't crash + { + QDeclarativeView *view = new QDeclarativeView; + view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); + + qApp->processEvents(); + + delete view; + } + + //make sure we get a compiler error + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype2.qml")); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); + c.create(); + + QVERIFY(c.errors().count() == 1); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: double expected")); + } + + //make sure we get a compiler error + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype3.qml")); + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeComponent: Component is not ready"); + c.create(); + + QVERIFY(c.errors().count() == 1); + QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: color expected")); + } + + //don't crash + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype4.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("state1"); + QTest::qWait(1000 + 50); + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); + QVERIFY(myRect); + QCOMPARE(myRect->x(),qreal(200)); + } +} + +void tst_qdeclarativeanimations::badProperties() +{ + //make sure we get a runtime error + { + QDeclarativeEngine engine; + + QDeclarativeComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml")); + QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existent property \"border.colr\""; + QTest::ignoreMessage(QtWarningMsg, message); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c1.create()); + QVERIFY(rect); + + QDeclarativeComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml")); + message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9) Cannot animate read-only property \"border\""; + QTest::ignoreMessage(QtWarningMsg, message); + rect = qobject_cast<QDeclarativeRectangle*>(c2.create()); + QVERIFY(rect); + + //### should we warn here are well? + //rect->setState("state1"); + } +} + +//test animating mixed types with property animation in a transition +//for example, int + real; color + real; etc +void tst_qdeclarativeanimations::mixedTypes() +{ + //assumes border.width stays a real -- not real robust + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("state1"); + QTest::qWait(500); + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); + QVERIFY(myRect); + + //rather inexact -- is there a better way? + QVERIFY(myRect->x() > 100 && myRect->x() < 200); + QVERIFY(myRect->border()->width() > 1 && myRect->border()->width() < 10); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("state1"); + QTest::qWait(500); + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("MyRect"); + QVERIFY(myRect); + + //rather inexact -- is there a better way? + QVERIFY(myRect->x() > 100 && myRect->x() < 200); + QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue")); + } +} + +void tst_qdeclarativeanimations::properties() +{ + const int waitDuration = 300; + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties3.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(300)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties4.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->y(),qreal(200)); + QTIMED_COMPARE(myRect->x(),qreal(100)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties5.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(100)); + QTIMED_COMPARE(myRect->y(),qreal(200)); + } +} + +void tst_qdeclarativeanimations::propertiesTransition() +{ + const int waitDuration = 300; + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(200)); + QCOMPARE(myRect->y(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->y(),qreal(200)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition3.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(200)); + QCOMPARE(myRect->y(),qreal(100)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(200)); + } + + /*{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition6.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *myRect = rect->findChild<QDeclarativeRectangle*>("TheRect"); + QVERIFY(myRect); + rect->setState("moved"); + QCOMPARE(myRect->x(),qreal(100)); + QTest::qWait(waitDuration); + QTIMED_COMPARE(myRect->x(),qreal(100)); + }*/ +} + +void tst_qdeclarativeanimations::invalidDuration() +{ + QDeclarativePropertyAnimation *animation = new QDeclarativePropertyAnimation; + QTest::ignoreMessage(QtWarningMsg, "QML PropertyAnimation (unknown location) Cannot set a duration of < 0"); + animation->setDuration(-1); + QCOMPARE(animation->duration(), 250); + + QDeclarativePauseAnimation *pauseAnimation = new QDeclarativePauseAnimation; + QTest::ignoreMessage(QtWarningMsg, "QML PauseAnimation (unknown location) Cannot set a duration of < 0"); + pauseAnimation->setDuration(-1); + QCOMPARE(pauseAnimation->duration(), 250); +} + +void tst_qdeclarativeanimations::attached() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/attached.qml")); + QTest::ignoreMessage(QtDebugMsg, "off"); + QTest::ignoreMessage(QtDebugMsg, "on"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); +} + +void tst_qdeclarativeanimations::propertyValueSourceDefaultStart() +{ + { + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource.qml")); + + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim); + QVERIFY(myAnim->isRunning()); + } + + { + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource2.qml")); + + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim); + QVERIFY(myAnim->isRunning() == false); + } + + { + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontAutoStart.qml")); + + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } +} + + +void tst_qdeclarativeanimations::dontStart() +{ + { + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } + + { + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); + } +} + +void tst_qdeclarativeanimations::easingProperties() +{ + { + QDeclarativeEngine engine; + QString componentStr = "import Qt 4.6\nNumberAnimation { easing.type: \"InOutQuad\" }"; + QDeclarativeComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutQuad); + } + + { + QDeclarativeEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutBounce\"; easing.amplitude: 5.0 }"; + QDeclarativeComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutBounce); + QCOMPARE(animObject->easing().amplitude(), 5.0); + } + + { + QDeclarativeEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"OutElastic\"; easing.amplitude: 5.0; easing.period: 3.0}"; + QDeclarativeComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::OutElastic); + QCOMPARE(animObject->easing().amplitude(), 5.0); + QCOMPARE(animObject->easing().period(), 3.0); + } + + { + QDeclarativeEngine engine; + QString componentStr = "import Qt 4.6\nPropertyAnimation { easing.type: \"InOutBack\"; easing.overshoot: 2 }"; + QDeclarativeComponent animationComponent(&engine); + animationComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativePropertyAnimation *animObject = qobject_cast<QDeclarativePropertyAnimation*>(animationComponent.create()); + + QVERIFY(animObject != 0); + QCOMPARE(animObject->easing().type(), QEasingCurve::InOutBack); + QCOMPARE(animObject->easing().overshoot(), 2.0); + } +} + +QTEST_MAIN(tst_qdeclarativeanimations) + +#include "tst_qdeclarativeanimations.moc" diff --git a/tests/auto/declarative/qmlbehaviors/data/binding.qml b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml index 201da37..201da37 100644 --- a/tests/auto/declarative/qmlbehaviors/data/binding.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/binding.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/color.qml b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml index 91dbbd1..91dbbd1 100644 --- a/tests/auto/declarative/qmlbehaviors/data/color.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/color.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/cpptrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml index 8d032f0..8d032f0 100644 --- a/tests/auto/declarative/qmlbehaviors/data/cpptrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/cpptrigger.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/disabled.qml b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml index 3c7078a..3c7078a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/disabled.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/disabled.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/dontStart.qml b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml index ba7cc9c..ba7cc9c 100644 --- a/tests/auto/declarative/qmlbehaviors/data/dontStart.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/dontStart.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/empty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml index 95d934a..95d934a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/empty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/empty.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/explicit.qml b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml index 1b2025a..1b2025a 100644 --- a/tests/auto/declarative/qmlbehaviors/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/explicit.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml index 14883d4..14883d4 100644 --- a/tests/auto/declarative/qmlbehaviors/data/groupProperty.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml index b43ddbc..b43ddbc 100644 --- a/tests/auto/declarative/qmlbehaviors/data/groupProperty2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/groupProperty2.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/loop.qml b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml index 5f2c057..5f2c057 100644 --- a/tests/auto/declarative/qmlbehaviors/data/loop.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/loop.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml index f267a05..f267a05 100644 --- a/tests/auto/declarative/qmlbehaviors/data/nonSelecting2.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/nonSelecting2.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/parent.qml b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml index 7c7fdcb..7c7fdcb 100644 --- a/tests/auto/declarative/qmlbehaviors/data/parent.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/parent.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml index ba744b1..ba744b1 100644 --- a/tests/auto/declarative/qmlbehaviors/data/reassignedAnimation.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/reassignedAnimation.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/scripttrigger.qml b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml index a91ca88..a91ca88 100644 --- a/tests/auto/declarative/qmlbehaviors/data/scripttrigger.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/scripttrigger.qml diff --git a/tests/auto/declarative/qmlbehaviors/data/simple.qml b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml index ac98ed0..ac98ed0 100644 --- a/tests/auto/declarative/qmlbehaviors/data/simple.qml +++ b/tests/auto/declarative/qdeclarativebehaviors/data/simple.qml diff --git a/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro new file mode 100644 index 0000000..a1dac32 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/qdeclarativebehaviors.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativebehaviors.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp new file mode 100644 index 0000000..f87330d --- /dev/null +++ b/tests/auto/declarative/qdeclarativebehaviors/tst_qdeclarativebehaviors.cpp @@ -0,0 +1,301 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativebehavior_p.h> +#include <private/qdeclarativeanimation_p.h> + +class tst_qdeclarativebehaviors : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativebehaviors() {} + +private slots: + void simpleBehavior(); + void scriptTriggered(); + void cppTriggered(); + void loop(); + void colorBehavior(); + void parentBehavior(); + void replaceBinding(); + //void transitionOverrides(); + void group(); + void emptyBehavior(); + void explicitSelection(); + void nonSelectingBehavior(); + void reassignedAnimation(); + void disabled(); + void dontStart(); +}; + +void tst_qdeclarativebehaviors::simpleBehavior() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + QVERIFY(qobject_cast<QDeclarativeBehavior*>(rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation()); + + rect->setState("moved"); + QTest::qWait(200); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered +} + +void tst_qdeclarativebehaviors::scriptTriggered() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setColor(QColor("red")); + QTest::qWait(200); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered +} + +void tst_qdeclarativebehaviors::cppTriggered() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect); + + innerRect->setProperty("x", 200); + QTest::qWait(200); + qreal x = innerRect->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered +} + +void tst_qdeclarativebehaviors::loop() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + //don't crash + rect->setState("moved"); +} + +void tst_qdeclarativebehaviors::colorBehavior() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("red"); + QTest::qWait(200); + QColor color = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->color(); + QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered +} + +void tst_qdeclarativebehaviors::parentBehavior() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("reparented"); + QTest::qWait(200); + QDeclarativeItem *newParent = rect->findChild<QDeclarativeItem*>("NewParent"); + QDeclarativeItem *parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); + QVERIFY(parent != newParent); + QTest::qWait(600); + parent = rect->findChild<QDeclarativeRectangle*>("MyRect")->parentItem(); + QVERIFY(parent == newParent); +} + +void tst_qdeclarativebehaviors::replaceBinding() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + QTest::qWait(200); + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect); + qreal x = innerRect->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + QTest::qWait(600); + QCOMPARE(innerRect->x(), (qreal)200); + rect->setProperty("basex", 10); + QCOMPARE(innerRect->x(), (qreal)200); + rect->setProperty("movedx", 210); + QTest::qWait(600); + QCOMPARE(innerRect->x(), (qreal)210); + + rect->setState(""); + QTest::qWait(200); + x = innerRect->x(); + QVERIFY(x > 10 && x < 210); //i.e. the behavior has been triggered + QTest::qWait(600); + QCOMPARE(innerRect->x(), (qreal)10); + rect->setProperty("movedx", 200); + QCOMPARE(innerRect->x(), (qreal)10); + rect->setProperty("basex", 20); + QTest::qWait(600); + QCOMPARE(innerRect->x(), (qreal)20); +} + +void tst_qdeclarativebehaviors::group() +{ + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + QTest::qWait(200); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + } + + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + QTest::qWait(200); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + } +} + +void tst_qdeclarativebehaviors::emptyBehavior() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QCOMPARE(x, qreal(200)); //should change immediately +} + +void tst_qdeclarativebehaviors::explicitSelection() +{ + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + QTest::qWait(200); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered + } +} + +void tst_qdeclarativebehaviors::nonSelectingBehavior() +{ + { + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + rect->setState("moved"); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QCOMPARE(x, qreal(200)); //should change immediately + } +} + +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()); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + QCOMPARE(qobject_cast<QDeclarativeNumberAnimation*>( + qobject_cast<QDeclarativeBehavior*>( + rect->findChild<QDeclarativeBehavior*>("MyBehavior"))->animation())->duration(), 200); +} + +void tst_qdeclarativebehaviors::disabled() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + QCOMPARE(rect->findChild<QDeclarativeBehavior*>("MyBehavior")->enabled(), false); + + rect->setState("moved"); + qreal x = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect"))->x(); + QCOMPARE(x, qreal(200)); //should change immediately +} + +void tst_qdeclarativebehaviors::dontStart() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); + + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect); + + QDeclarativeAbstractAnimation *myAnim = rect->findChild<QDeclarativeAbstractAnimation*>("MyAnim"); + QVERIFY(myAnim && myAnim->qtAnimation()); + QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); +} + +QTEST_MAIN(tst_qdeclarativebehaviors) + +#include "tst_qdeclarativebehaviors.moc" diff --git a/tests/auto/declarative/qmlbinding/data/test-binding.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml index e9101e4..e9101e4 100644 --- a/tests/auto/declarative/qmlbinding/data/test-binding.qml +++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding.qml diff --git a/tests/auto/declarative/qmlbinding/data/test-binding2.qml b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml index ea20c16..ea20c16 100644 --- a/tests/auto/declarative/qmlbinding/data/test-binding2.qml +++ b/tests/auto/declarative/qdeclarativebinding/data/test-binding2.qml diff --git a/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro new file mode 100644 index 0000000..7879976 --- /dev/null +++ b/tests/auto/declarative/qdeclarativebinding/qdeclarativebinding.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativebinding.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp new file mode 100644 index 0000000..826df4f --- /dev/null +++ b/tests/auto/declarative/qdeclarativebinding/tst_qdeclarativebinding.cpp @@ -0,0 +1,107 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativebind_p.h> +#include <private/qdeclarativerectangle_p.h> +#include "../../../shared/util.h" + +class tst_qdeclarativebinding : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativebinding(); + +private slots: + void binding(); + void whenAfterValue(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativebinding::tst_qdeclarativebinding() +{ +} + +void tst_qdeclarativebinding::binding() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + + QVERIFY(rect != 0); + QCOMPARE(rect->color(), QColor("yellow")); + QCOMPARE(rect->property("text").toString(), QString("Hello")); + + rect->setProperty("changeColor", true); + QCOMPARE(rect->color(), QColor("red")); + + QDeclarativeBind *binding = qobject_cast<QDeclarativeBind*>(rect->findChild<QDeclarativeBind*>("binding1")); + QVERIFY(binding != 0); + QCOMPARE(binding->object(), rect); + QCOMPARE(binding->property(), QLatin1String("text")); + QCOMPARE(binding->value().toString(), QLatin1String("Hello")); + + delete rect; +} + +void tst_qdeclarativebinding::whenAfterValue() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding2.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + + QVERIFY(rect != 0); + QCOMPARE(rect->color(), QColor("yellow")); + QCOMPARE(rect->property("text").toString(), QString("Hello")); + + rect->setProperty("changeColor", true); + QCOMPARE(rect->color(), QColor("red")); + + delete rect; +} + +QTEST_MAIN(tst_qdeclarativebinding) + +#include "tst_qdeclarativebinding.moc" diff --git a/tests/auto/declarative/qmlgraphicsborderimage/data/colors-round.sci b/tests/auto/declarative/qdeclarativeborderimage/data/colors-round.sci index 5d2f49f..5d2f49f 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/data/colors-round.sci +++ b/tests/auto/declarative/qdeclarativeborderimage/data/colors-round.sci diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors.png b/tests/auto/declarative/qdeclarativeborderimage/data/colors.png Binary files differindex dfb62f3..dfb62f3 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors.png +++ b/tests/auto/declarative/qdeclarativeborderimage/data/colors.png diff --git a/tests/auto/declarative/qmlgraphicsborderimage/data/invalid.sci b/tests/auto/declarative/qdeclarativeborderimage/data/invalid.sci index 98c72c9..98c72c9 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/data/invalid.sci +++ b/tests/auto/declarative/qdeclarativeborderimage/data/invalid.sci diff --git a/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro new file mode 100644 index 0000000..0574ddb --- /dev/null +++ b/tests/auto/declarative/qdeclarativeborderimage/qdeclarativeborderimage.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativeborderimage.cpp ../shared/testhttpserver.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp new file mode 100644 index 0000000..8aeba6d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeborderimage/tst_qdeclarativeborderimage.cpp @@ -0,0 +1,351 @@ +/**************************************************************************** +** +** 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 <QTextDocument> +#include <QTcpServer> +#include <QTcpSocket> +#include <QDir> + +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeborderimage_p.h> +#include <private/qdeclarativeimagebase_p.h> +#include <private/qdeclarativescalegrid_p_p.h> +#include <private/qdeclarativeloader_p.h> +#include <QtDeclarative/qdeclarativecontext.h> + +#include "../shared/testhttpserver.h" + + +#define SERVER_PORT 14445 +#define SERVER_ADDR "http://127.0.0.1:14445" + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 60; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + + +class tst_qdeclarativeborderimage : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativeborderimage(); + +private slots: + void noSource(); + void imageSource(); + void imageSource_data(); + void clearSource(); + void resized(); + void smooth(); + void tileModes(); + void sciSource(); + void sciSource_data(); + void invalidSciFile(); + void pendingRemoteRequest(); + void pendingRemoteRequest_data(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeborderimage::tst_qdeclarativeborderimage() +{ +} + +void tst_qdeclarativeborderimage::noSource() +{ + QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->source(), QUrl()); + QCOMPARE(obj->width(), 0.); + QCOMPARE(obj->height(), 0.); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeborderimage::imageSource_data() +{ + QTest::addColumn<QString>("source"); + QTest::addColumn<bool>("remote"); + QTest::addColumn<QString>("error"); + + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << ""; + QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false + << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; + QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true + << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; +} + +void tst_qdeclarativeborderimage::imageSource() +{ + QFETCH(QString, source); + QFETCH(bool, remote); + QFETCH(QString, error); + + TestHTTPServer *server = 0; + if (remote) { + server = new TestHTTPServer(SERVER_PORT); + QVERIFY(server->isValid()); + server->serveDirectory(SRCDIR "/data"); + } + + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + + if (remote) + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); + + QCOMPARE(obj->source(), remote ? source : QUrl(source)); + + if (error.isEmpty()) { + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); + QCOMPARE(obj->width(), 120.); + QCOMPARE(obj->height(), 120.); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); + } else { + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Error); + } + + delete obj; + delete server; +} + +void tst_qdeclarativeborderimage::clearSource() +{ + QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QVERIFY(obj->status() == QDeclarativeBorderImage::Ready); + QCOMPARE(obj->width(), 120.); + QCOMPARE(obj->height(), 120.); + + ctxt->setContextProperty("srcImage", ""); + QVERIFY(obj->source().isEmpty()); + QVERIFY(obj->status() == QDeclarativeBorderImage::Null); + QCOMPARE(obj->width(), 0.); + QCOMPARE(obj->height(), 0.); +} + +void tst_qdeclarativeborderimage::resized() +{ + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeborderimage::smooth() +{ + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->smooth(), true); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeborderimage::tileModes() +{ + { + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 100.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Repeat); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Repeat); + + delete obj; + } + { + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 150.); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Round); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Round); + + delete obj; + } +} + +void tst_qdeclarativeborderimage::sciSource() +{ + QFETCH(QString, source); + QFETCH(bool, valid); + + bool remote = source.startsWith("http"); + TestHTTPServer *server = 0; + if (remote) { + server = new TestHTTPServer(SERVER_PORT); + QVERIFY(server->isValid()); + server->serveDirectory(SRCDIR "/data"); + } + + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + + if (remote) + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Loading); + + QCOMPARE(obj->source(), remote ? source : QUrl(source)); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + + if (valid) { + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Ready); + QCOMPARE(obj->border()->left(), 10); + QCOMPARE(obj->border()->top(), 20); + QCOMPARE(obj->border()->right(), 30); + QCOMPARE(obj->border()->bottom(), 40); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Round); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Repeat); + } else { + TRY_WAIT(obj->status() == QDeclarativeBorderImage::Error); + } + + delete obj; + delete server; +} + +void tst_qdeclarativeborderimage::sciSource_data() +{ + QTest::addColumn<QString>("source"); + QTest::addColumn<bool>("valid"); + + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true; + QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false; + QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true; + QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false; +} + +void tst_qdeclarativeborderimage::invalidSciFile() +{ + QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" + QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" + + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->status(), QDeclarativeImageBase::Error); + QCOMPARE(obj->horizontalTileMode(), QDeclarativeBorderImage::Stretch); + QCOMPARE(obj->verticalTileMode(), QDeclarativeBorderImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeborderimage::pendingRemoteRequest() +{ + QFETCH(QString, source); + + QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeBorderImage *obj = qobject_cast<QDeclarativeBorderImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->status(), QDeclarativeBorderImage::Loading); + + // verify no crash + // This will cause a delayed "QThread: Destroyed while thread is still running" warning + delete obj; + QTest::qWait(50); +} + +void tst_qdeclarativeborderimage::pendingRemoteRequest_data() +{ + QTest::addColumn<QString>("source"); + + QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; + QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; +} + +QTEST_MAIN(tst_qdeclarativeborderimage) + +#include "tst_qdeclarativeborderimage.moc" diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml new file mode 100644 index 0000000..81ab599 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id: screen; width: 50 + + property bool tested: false + signal testMe + + Connections { target: screen; onWidthChanged: screen.tested = true } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml new file mode 100644 index 0000000..22e9422 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection2.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +Connections { id: connection; target: connection; onTargetChanged: 1 == 1 } diff --git a/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml b/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml new file mode 100644 index 0000000..6e396c0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/test-connection3.qml @@ -0,0 +1,3 @@ +import Qt 4.6 + +Connections {} diff --git a/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml b/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml new file mode 100644 index 0000000..736d5e8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/data/trimming.qml @@ -0,0 +1,10 @@ +import Qt 4.6 + +Item { + id: screen; width: 50 + + property string tested + signal testMe(int param1, string param2) + + Connections { target: screen; onTestMe: screen.tested = param2 + param1 } +} diff --git a/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro new file mode 100644 index 0000000..a6adfa4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/qdeclarativeconnection.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeconnection.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp new file mode 100644 index 0000000..f4914e1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeconnection/tst_qdeclarativeconnection.cpp @@ -0,0 +1,135 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeconnections_p.h> +#include <private/qdeclarativeitem_p.h> +#include "../../../shared/util.h" +#include <QtDeclarative/qdeclarativescriptstring.h> + +class tst_qdeclarativeconnection : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativeconnection(); + +private slots: + void defaultValues(); + void properties(); + void connection(); + void trimming(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeconnection::tst_qdeclarativeconnection() +{ +} + +void tst_qdeclarativeconnection::defaultValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection3.qml")); + QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create()); + + QVERIFY(item != 0); + QVERIFY(item->target() == 0); + + delete item; +} + +void tst_qdeclarativeconnection::properties() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection2.qml")); + QDeclarativeConnections *item = qobject_cast<QDeclarativeConnections*>(c.create()); + + QVERIFY(item != 0); + + QVERIFY(item != 0); + QVERIFY(item->target() == item); + + delete item; +} + +void tst_qdeclarativeconnection::connection() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(c.create()); + + QVERIFY(item != 0); + + QCOMPARE(item->property("tested").toBool(), false); + QCOMPARE(item->width(), 50.); + emit item->setWidth(100.); + QCOMPARE(item->width(), 100.); + QCOMPARE(item->property("tested").toBool(), true); + + delete item; +} + +void tst_qdeclarativeconnection::trimming() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/trimming.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(c.create()); + + QVERIFY(item != 0); + + QCOMPARE(item->property("tested").toString(), QString("")); + int index = item->metaObject()->indexOfSignal("testMe(int,QString)"); + QMetaMethod method = item->metaObject()->method(index); + method.invoke(item, + Qt::DirectConnection, + Q_ARG(int, 5), + Q_ARG(QString, "worked")); + QCOMPARE(item->property("tested").toString(), QString("worked5")); + + delete item; +} + +QTEST_MAIN(tst_qdeclarativeconnection) + +#include "tst_qdeclarativeconnection.moc" diff --git a/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro new file mode 100644 index 0000000..adace70 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecontext/qdeclarativecontext.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativecontext.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp new file mode 100644 index 0000000..5f03989 --- /dev/null +++ b/tests/auto/declarative/qdeclarativecontext/tst_qdeclarativecontext.cpp @@ -0,0 +1,434 @@ +/**************************************************************************** +** +** 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 <QDebug> +#include <QDeclarativeEngine> +#include <QDeclarativeContext> +#include <QDeclarativeComponent> +#include <QDeclarativeExpression> + +class tst_qdeclarativecontext : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativecontext() {} + +private slots: + void baseUrl(); + void resolvedUrl(); + void engineMethod(); + void parentContext(); + void setContextProperty(); + void addDefaultObject(); + void destruction(); + +private: + QDeclarativeEngine engine; +}; + +void tst_qdeclarativecontext::baseUrl() +{ + QDeclarativeContext ctxt(&engine); + + QCOMPARE(ctxt.baseUrl(), QUrl()); + + ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); + + QCOMPARE(ctxt.baseUrl(), QUrl("http://www.nokia.com/")); +} + +void tst_qdeclarativecontext::resolvedUrl() +{ + // Relative to the component + { + QDeclarativeContext ctxt(&engine); + ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); + + QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), QUrl("http://www.nokia.com/main.qml")); + } + + // Relative to a parent + { + QDeclarativeContext ctxt(&engine); + ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); + + QDeclarativeContext ctxt2(&ctxt); + QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml")); + } + + // Relative to the engine + { + QDeclarativeContext ctxt(&engine); + QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), engine.baseUrl().resolved(QUrl("main.qml"))); + } + + // Relative to a deleted parent + { + QDeclarativeContext *ctxt = new QDeclarativeContext(&engine); + ctxt->setBaseUrl(QUrl("http://www.nokia.com/")); + + QDeclarativeContext ctxt2(ctxt); + QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml")); + + delete ctxt; ctxt = 0; + + QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl()); + } + + // Absolute + { + QDeclarativeContext ctxt(&engine); + + QCOMPARE(ctxt.resolvedUrl(QUrl("http://www.nokia.com/main2.qml")), QUrl("http://www.nokia.com/main2.qml")); + QCOMPARE(ctxt.resolvedUrl(QUrl("file:///main2.qml")), QUrl("file:///main2.qml")); + } +} + +void tst_qdeclarativecontext::engineMethod() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + + QDeclarativeContext ctxt(engine); + QDeclarativeContext ctxt2(&ctxt); + QDeclarativeContext ctxt3(&ctxt2); + QDeclarativeContext ctxt4(&ctxt2); + + QCOMPARE(ctxt.engine(), engine); + QCOMPARE(ctxt2.engine(), engine); + QCOMPARE(ctxt3.engine(), engine); + QCOMPARE(ctxt4.engine(), engine); + + delete engine; engine = 0; + + QCOMPARE(ctxt.engine(), engine); + QCOMPARE(ctxt2.engine(), engine); + QCOMPARE(ctxt3.engine(), engine); + QCOMPARE(ctxt4.engine(), engine); +} + +void tst_qdeclarativecontext::parentContext() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + + QCOMPARE(engine->rootContext()->parentContext(), (QDeclarativeContext *)0); + + QDeclarativeContext *ctxt = new QDeclarativeContext(engine); + QDeclarativeContext *ctxt2 = new QDeclarativeContext(ctxt); + QDeclarativeContext *ctxt3 = new QDeclarativeContext(ctxt2); + QDeclarativeContext *ctxt4 = new QDeclarativeContext(ctxt2); + QDeclarativeContext *ctxt5 = new QDeclarativeContext(ctxt); + QDeclarativeContext *ctxt6 = new QDeclarativeContext(engine); + QDeclarativeContext *ctxt7 = new QDeclarativeContext(engine->rootContext()); + + QCOMPARE(ctxt->parentContext(), engine->rootContext()); + QCOMPARE(ctxt2->parentContext(), ctxt); + QCOMPARE(ctxt3->parentContext(), ctxt2); + QCOMPARE(ctxt4->parentContext(), ctxt2); + QCOMPARE(ctxt5->parentContext(), ctxt); + QCOMPARE(ctxt6->parentContext(), engine->rootContext()); + QCOMPARE(ctxt7->parentContext(), engine->rootContext()); + + delete ctxt2; ctxt2 = 0; + + QCOMPARE(ctxt->parentContext(), engine->rootContext()); + QCOMPARE(ctxt3->parentContext(), ctxt2); + QCOMPARE(ctxt4->parentContext(), ctxt2); + QCOMPARE(ctxt5->parentContext(), ctxt); + QCOMPARE(ctxt6->parentContext(), engine->rootContext()); + QCOMPARE(ctxt7->parentContext(), engine->rootContext()); + + delete engine; engine = 0; + + QCOMPARE(ctxt->parentContext(), (QDeclarativeContext *)0); + QCOMPARE(ctxt3->parentContext(), ctxt2); + QCOMPARE(ctxt4->parentContext(), ctxt2); + QCOMPARE(ctxt5->parentContext(), ctxt); + QCOMPARE(ctxt6->parentContext(), (QDeclarativeContext *)0); + QCOMPARE(ctxt7->parentContext(), (QDeclarativeContext *)0); + + delete ctxt7; + delete ctxt6; + delete ctxt5; + delete ctxt4; + delete ctxt3; + delete ctxt; +} + +class TestObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int a READ a NOTIFY aChanged) + Q_PROPERTY(int b READ b NOTIFY bChanged) + Q_PROPERTY(int c READ c NOTIFY cChanged) + +public: + TestObject() : _a(10), _b(10), _c(10) {} + + int a() const { return _a; } + void setA(int a) { _a = a; emit aChanged(); } + + int b() const { return _b; } + void setB(int b) { _b = b; emit bChanged(); } + + int c() const { return _c; } + void setC(int c) { _c = c; emit cChanged(); } + +signals: + void aChanged(); + void bChanged(); + void cChanged(); + +private: + int _a; + int _b; + int _c; +}; + +class TestObject2 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int b READ b NOTIFY bChanged) + +public: + TestObject2() : _b(10) {} + + int b() const { return _b; } + void setB(int b) { _b = b; emit bChanged(); } + +signals: + void bChanged(); + +private: + int _b; +}; + +#define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ +{ \ + QDeclarativeComponent component(&engine); \ + component.setData("import Qt 4.6; QtObject { property var test: " #name " }", QUrl()); \ +\ + QObject *obj = component.create(ctxt); \ +\ + QCOMPARE(obj->property("test"), value); \ +\ + delete obj; \ +} + +void tst_qdeclarativecontext::setContextProperty() +{ + QDeclarativeContext ctxt(&engine); + QDeclarativeContext ctxt2(&ctxt); + + TestObject obj1; + obj1.setA(3345); + TestObject obj2; + obj2.setA(-19); + + // Static context properties + ctxt.setContextProperty("a", QVariant(10)); + ctxt.setContextProperty("b", QVariant(9)); + ctxt2.setContextProperty("d", &obj2); + ctxt2.setContextProperty("b", QVariant(19)); + ctxt2.setContextProperty("c", QVariant(QString("Hello World!"))); + ctxt.setContextProperty("d", &obj1); + ctxt.setContextProperty("e", &obj1); + + TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(10)); + TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(19)); + TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hello World!"))); + TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(-19)); + TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(3345)); + + ctxt.setContextProperty("a", QVariant(13)); + ctxt.setContextProperty("b", QVariant(4)); + ctxt2.setContextProperty("b", QVariant(8)); + ctxt2.setContextProperty("c", QVariant(QString("Hi World!"))); + ctxt2.setContextProperty("d", &obj1); + obj1.setA(12); + + TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(13)); + TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(8)); + TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hi World!"))); + TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(12)); + TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(12)); + + // Changes in context properties + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + + QObject *obj = component.create(&ctxt2); + + QCOMPARE(obj->property("test"), QVariant(13)); + ctxt.setContextProperty("a", QVariant(19)); + QCOMPARE(obj->property("test"), QVariant(19)); + + delete obj; + } + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var test: b }", QUrl()); + + QObject *obj = component.create(&ctxt2); + + QCOMPARE(obj->property("test"), QVariant(8)); + ctxt.setContextProperty("b", QVariant(5)); + QCOMPARE(obj->property("test"), QVariant(8)); + ctxt2.setContextProperty("b", QVariant(1912)); + QCOMPARE(obj->property("test"), QVariant(1912)); + + delete obj; + } + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var test: e.a }", QUrl()); + + QObject *obj = component.create(&ctxt2); + + QCOMPARE(obj->property("test"), QVariant(12)); + obj1.setA(13); + QCOMPARE(obj->property("test"), QVariant(13)); + + delete obj; + } + + // New context properties + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + + QObject *obj = component.create(&ctxt2); + + QCOMPARE(obj->property("test"), QVariant(19)); + ctxt2.setContextProperty("a", QVariant(1945)); + QCOMPARE(obj->property("test"), QVariant(1945)); + + delete obj; + } + + // Setting an object-variant context property + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property var obj: root; }", QUrl()); + + QDeclarativeContext ctxt(engine.rootContext()); + ctxt.setContextProperty("ctxtProp", QVariant()); + + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1: TypeError: Result of expression 'ctxtProp' [undefined] is not an object."); + QObject *obj = component.create(&ctxt); + + QVariant v = obj->property("obj"); + + ctxt.setContextProperty("ctxtProp", v); + + QCOMPARE(obj->property("test"), QVariant(10)); + + delete obj; + } +} + +void tst_qdeclarativecontext::addDefaultObject() +{ + QDeclarativeContext ctxt(&engine); + + TestObject to; + TestObject2 to2; + + to.setA(2); + to.setB(192); + to.setC(18); + to2.setB(111999); + + ctxt.addDefaultObject(&to2); + ctxt.addDefaultObject(&to); + ctxt.setContextProperty("c", QVariant(9)); + + // Static context properties + TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(2)); + TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(111999)); + TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(9)); + + to.setA(12); + to.setB(100); + to.setC(7); + to2.setB(1612); + ctxt.setContextProperty("c", QVariant(3)); + + TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(12)); + TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(1612)); + TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(3)); + + // Changes in context properties + { + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); + + QObject *obj = component.create(&ctxt); + + QCOMPARE(obj->property("test"), QVariant(12)); + to.setA(14); + QCOMPARE(obj->property("test"), QVariant(14)); + + delete obj; + } +} + +void tst_qdeclarativecontext::destruction() +{ + QDeclarativeContext *ctxt = new QDeclarativeContext(&engine); + + QObject obj; + QDeclarativeEngine::setContextForObject(&obj, ctxt); + QDeclarativeExpression expr(ctxt, "a", 0); + + QCOMPARE(ctxt, QDeclarativeEngine::contextForObject(&obj)); + QCOMPARE(ctxt, expr.context()); + + delete ctxt; ctxt = 0; + + QCOMPARE(ctxt, QDeclarativeEngine::contextForObject(&obj)); + QCOMPARE(ctxt, expr.context()); +} + +QTEST_MAIN(tst_qdeclarativecontext) + +#include "tst_qdeclarativecontext.moc" diff --git a/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro b/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro new file mode 100644 index 0000000..22f53e6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedatetimeformatter/qdeclarativedatetimeformatter.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativedatetimeformatter.cpp diff --git a/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp b/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp new file mode 100644 index 0000000..69d7900 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedatetimeformatter/tst_qdeclarativedatetimeformatter.cpp @@ -0,0 +1,150 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativedatetimeformatter_p.h> +#include <QDebug> + +class tst_qdeclarativedatetimeformatter : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativedatetimeformatter() {} + +private slots: + void date(); + void time(); + void dateTime(); +}; + +void tst_qdeclarativedatetimeformatter::date() +{ + QDeclarativeEngine engine; + QDeclarativeComponent formatterComponent(&engine); + formatterComponent.setData(QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), + QUrl::fromLocalFile("")); + QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); + if(formatterComponent.isError()) + qDebug() << formatterComponent.errors(); + QVERIFY(formatter != 0); + + QDate date(2008,12,24); + QCOMPARE(formatter->date(), date); + QCOMPARE(formatter->dateTime().date(), date); + QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleShortDate)); + + formatter->setLongStyle(true); + QVERIFY(formatter->longStyle()); + QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleLongDate)); + + formatter->setDateFormat("ddd MMMM d yy"); + QCOMPARE(formatter->dateFormat(), QLatin1String("ddd MMMM d yy")); + QCOMPARE(formatter->dateText(),date.toString("ddd MMMM d yy")); + + QVERIFY(formatter->timeText().isEmpty()); + QVERIFY(formatter->dateTimeText().isEmpty()); + + delete formatter; +} + +void tst_qdeclarativedatetimeformatter::time() +{ + QDeclarativeEngine engine; + QDeclarativeComponent formatterComponent(&engine); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl::fromLocalFile("")); + QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); + if(formatterComponent.isError()) + qDebug() << formatterComponent.errors(); + QVERIFY(formatter != 0); + + QTime time(14,15,38,200); + + QCOMPARE(formatter->time(),time); + QCOMPARE(formatter->dateTime().time(),time); + + QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleShortDate)); + + formatter->setLongStyle(true); + QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleLongDate)); + + formatter->setTimeFormat("H:m:s a"); + QCOMPARE(formatter->timeFormat(), QLatin1String("H:m:s a")); + QCOMPARE(formatter->timeText(),time.toString("H:m:s a")); + + formatter->setTimeFormat("hh:mm:ss.zzz"); + QCOMPARE(formatter->timeText(),time.toString("hh:mm:ss.zzz")); + + QVERIFY(formatter->dateText().isEmpty()); + QVERIFY(formatter->dateTimeText().isEmpty()); + + delete formatter; +} + +void tst_qdeclarativedatetimeformatter::dateTime() +{ + QDeclarativeEngine engine; + QDeclarativeComponent formatterComponent(&engine); + formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl::fromLocalFile("")); + QDeclarativeDateTimeFormatter *formatter = qobject_cast<QDeclarativeDateTimeFormatter*>(formatterComponent.create()); + if(formatterComponent.isError()) + qDebug() << formatterComponent.errors(); + QVERIFY(formatter != 0); + + QDateTime dateTime(QDate(1978,03,04),QTime(9,13,54)); + QCOMPARE(formatter->dateTime(),dateTime); + QCOMPARE(formatter->date(),dateTime.date()); + QCOMPARE(formatter->time(),dateTime.time()); + QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleShortDate)); + + formatter->setLongStyle(true); + QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleLongDate)); + + formatter->setDateTimeFormat("M/d/yy H:m:s a"); + QCOMPARE(formatter->dateTimeFormat(), QLatin1String("M/d/yy H:m:s a")); + QCOMPARE(formatter->dateTimeText(),dateTime.toString("M/d/yy H:m:s a")); + + delete formatter; +} + +QTEST_MAIN(tst_qdeclarativedatetimeformatter) + +#include "tst_qdeclarativedatetimeformatter.moc" diff --git a/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro new file mode 100644 index 0000000..ff1d0d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebug/qdeclarativedebug.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += network declarative +macx:CONFIG -= app_bundle + +HEADERS += ../shared/debugutil_p.h +SOURCES += tst_qdeclarativedebug.cpp \ + ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp new file mode 100644 index 0000000..0c3ca76 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebug/tst_qdeclarativedebug.cpp @@ -0,0 +1,843 @@ +/**************************************************************************** +** +** 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 <QSignalSpy> +#include <QTimer> +#include <QHostAddress> +#include <QDebug> +#include <QThread> + +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeexpression.h> +#include <QtDeclarative/qdeclarativeproperty.h> + +#include <private/qdeclarativebinding_p.h> +#include <private/qdeclarativedebug_p.h> +#include <private/qdeclarativeenginedebug_p.h> +#include <private/qdeclarativedebugclient_p.h> +#include <private/qdeclarativedebugservice_p.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativemetatype_p.h> +#include <private/qdeclarativeproperty_p.h> + +#include "../shared/debugutil_p.h" + +Q_DECLARE_METATYPE(QDeclarativeDebugWatch::State) + + +class tst_QDeclarativeDebug : public QObject +{ + Q_OBJECT + +public: + tst_QDeclarativeDebug(QDeclarativeDebugTestData *data) + { + m_conn = data->conn; + m_engine = data->engine; + m_rootItem = data->items[0]; + } + +private: + QDeclarativeDebugObjectReference findRootObject(); + QDeclarativeDebugPropertyReference findProperty(const QList<QDeclarativeDebugPropertyReference> &props, const QString &name) const; + void waitForQuery(QDeclarativeDebugQuery *query); + + void recursiveObjectTest(QObject *o, const QDeclarativeDebugObjectReference &oref, bool recursive) const; + + void recursiveCompareObjects(const QDeclarativeDebugObjectReference &a, const QDeclarativeDebugObjectReference &b) const; + void recursiveCompareContexts(const QDeclarativeDebugContextReference &a, const QDeclarativeDebugContextReference &b) const; + void compareProperties(const QDeclarativeDebugPropertyReference &a, const QDeclarativeDebugPropertyReference &b) const; + + QDeclarativeDebugConnection *m_conn; + QDeclarativeEngineDebug *m_dbg; + QDeclarativeEngine *m_engine; + QDeclarativeItem *m_rootItem; + +private slots: + void initTestCase(); + + void watch_property(); + void watch_object(); + void watch_expression(); + void watch_expression_data(); + void watch_context(); + void watch_file(); + + void queryAvailableEngines(); + void queryRootContexts(); + void queryObject(); + void queryObject_data(); + void queryExpressionResult(); + void queryExpressionResult_data(); + + void tst_QDeclarativeDebugFileReference(); + void tst_QDeclarativeDebugEngineReference(); + void tst_QDeclarativeDebugObjectReference(); + void tst_QDeclarativeDebugContextReference(); + void tst_QDeclarativeDebugPropertyReference(); +}; + +QDeclarativeDebugObjectReference tst_QDeclarativeDebug::findRootObject() +{ + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + + if (q_engines->engines().count() == 0) + return QDeclarativeDebugObjectReference(); + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + + if (q_context->rootContext().objects().count() == 0) + return QDeclarativeDebugObjectReference(); + QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); + waitForQuery(q_obj); + + QDeclarativeDebugObjectReference result = q_obj->object(); + + delete q_engines; + delete q_context; + delete q_obj; + + return result; +} + +QDeclarativeDebugPropertyReference tst_QDeclarativeDebug::findProperty(const QList<QDeclarativeDebugPropertyReference> &props, const QString &name) const +{ + foreach(const QDeclarativeDebugPropertyReference &p, props) { + if (p.name() == name) + return p; + } + return QDeclarativeDebugPropertyReference(); +} + +void tst_QDeclarativeDebug::waitForQuery(QDeclarativeDebugQuery *query) +{ + QVERIFY(query); + QCOMPARE(query->parent(), this); + QVERIFY(query->state() == QDeclarativeDebugQuery::Waiting); + if (!QDeclarativeDebugTest::waitForSignal(query, SIGNAL(stateChanged(QDeclarativeDebugQuery::State)))) + QFAIL("query timed out"); +} + +void tst_QDeclarativeDebug::recursiveObjectTest(QObject *o, const QDeclarativeDebugObjectReference &oref, bool recursive) const +{ + const QMetaObject *meta = o->metaObject(); + + QDeclarativeType *type = QDeclarativeMetaType::qmlType(o->metaObject()); + QString className = type ? type->qmlTypeName() : QString(); + className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1); + + QCOMPARE(oref.debugId(), QDeclarativeDebugService::idForObject(o)); + QCOMPARE(oref.name(), o->objectName()); + QCOMPARE(oref.className(), className); + QCOMPARE(oref.contextDebugId(), QDeclarativeDebugService::idForObject(qmlContext(o))); + + const QObjectList &children = o->children(); + for (int i=0; i<children.count(); i++) { + QObject *child = children[i]; + if (!qmlContext(child)) + continue; + int debugId = QDeclarativeDebugService::idForObject(child); + QVERIFY(debugId >= 0); + + QDeclarativeDebugObjectReference cref; + foreach (const QDeclarativeDebugObjectReference &ref, oref.children()) { + if (ref.debugId() == debugId) { + cref = ref; + break; + } + } + QVERIFY(cref.debugId() >= 0); + + if (recursive) + recursiveObjectTest(child, cref, true); + } + + foreach (const QDeclarativeDebugPropertyReference &p, oref.properties()) { + QCOMPARE(p.objectDebugId(), QDeclarativeDebugService::idForObject(o)); + + // signal properties are fake - they are generated from QDeclarativeBoundSignal children + if (p.name().startsWith("on") && p.name().length() > 2 && p.name()[2].isUpper()) { + QVERIFY(p.value().toString().startsWith('{') && p.value().toString().endsWith('}')); + QVERIFY(p.valueTypeName().isEmpty()); + QVERIFY(p.binding().isEmpty()); + QVERIFY(!p.hasNotifySignal()); + continue; + } + + QMetaProperty pmeta = meta->property(meta->indexOfProperty(p.name().toUtf8().constData())); + + QCOMPARE(p.name(), QString::fromUtf8(pmeta.name())); + + if (pmeta.type() < QVariant::UserType) // TODO test complex types + QCOMPARE(p.value(), pmeta.read(o)); + + if (p.name() == "parent") + QVERIFY(p.valueTypeName() == "QGraphicsObject*" || p.valueTypeName() == "QDeclarativeItem*"); + else + QCOMPARE(p.valueTypeName(), QString::fromUtf8(pmeta.typeName())); + + QDeclarativeAbstractBinding *binding = + QDeclarativePropertyPrivate::binding(QDeclarativeProperty(o, p.name())); + if (binding) + QCOMPARE(binding->expression(), p.binding()); + + QCOMPARE(p.hasNotifySignal(), pmeta.hasNotifySignal()); + + QVERIFY(pmeta.isValid()); + } +} + +void tst_QDeclarativeDebug::recursiveCompareObjects(const QDeclarativeDebugObjectReference &a, const QDeclarativeDebugObjectReference &b) const +{ + QCOMPARE(a.debugId(), b.debugId()); + QCOMPARE(a.className(), b.className()); + QCOMPARE(a.name(), b.name()); + QCOMPARE(a.contextDebugId(), b.contextDebugId()); + + QCOMPARE(a.source().url(), b.source().url()); + QCOMPARE(a.source().lineNumber(), b.source().lineNumber()); + QCOMPARE(a.source().columnNumber(), b.source().columnNumber()); + + QCOMPARE(a.properties().count(), b.properties().count()); + QCOMPARE(a.children().count(), b.children().count()); + + QList<QDeclarativeDebugPropertyReference> aprops = a.properties(); + QList<QDeclarativeDebugPropertyReference> bprops = b.properties(); + + for (int i=0; i<aprops.count(); i++) + compareProperties(aprops[i], bprops[i]); + + for (int i=0; i<a.children().count(); i++) + recursiveCompareObjects(a.children()[i], b.children()[i]); +} + +void tst_QDeclarativeDebug::recursiveCompareContexts(const QDeclarativeDebugContextReference &a, const QDeclarativeDebugContextReference &b) const +{ + QCOMPARE(a.debugId(), b.debugId()); + QCOMPARE(a.name(), b.name()); + QCOMPARE(a.objects().count(), b.objects().count()); + QCOMPARE(a.contexts().count(), b.contexts().count()); + + for (int i=0; i<a.objects().count(); i++) + recursiveCompareObjects(a.objects()[i], b.objects()[i]); + + for (int i=0; i<a.contexts().count(); i++) + recursiveCompareContexts(a.contexts()[i], b.contexts()[i]); +} + +void tst_QDeclarativeDebug::compareProperties(const QDeclarativeDebugPropertyReference &a, const QDeclarativeDebugPropertyReference &b) const +{ + QCOMPARE(a.objectDebugId(), b.objectDebugId()); + QCOMPARE(a.name(), b.name()); + QCOMPARE(a.value(), b.value()); + QCOMPARE(a.valueTypeName(), b.valueTypeName()); + QCOMPARE(a.binding(), b.binding()); + QCOMPARE(a.hasNotifySignal(), b.hasNotifySignal()); +} + +void tst_QDeclarativeDebug::initTestCase() +{ + m_dbg = new QDeclarativeEngineDebug(m_conn, this); + + qRegisterMetaType<QDeclarativeDebugWatch::State>(); +} + +void tst_QDeclarativeDebug::watch_property() +{ + QDeclarativeDebugObjectReference obj = findRootObject(); + QDeclarativeDebugPropertyReference prop = findProperty(obj.properties(), "width"); + + QDeclarativeDebugPropertyWatch *watch; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + watch = unconnected->addWatch(prop, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); + delete watch; + delete unconnected; + + watch = m_dbg->addWatch(QDeclarativeDebugPropertyReference(), this); + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); + delete watch; + + watch = m_dbg->addWatch(prop, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting); + QCOMPARE(watch->objectDebugId(), obj.debugId()); + QCOMPARE(watch->name(), prop.name()); + + QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); + + int origWidth = m_rootItem->property("width").toInt(); + m_rootItem->setProperty("width", origWidth*2); + + // stateChanged() is received before valueChanged() + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Active); + QCOMPARE(spy.count(), 1); + + m_dbg->removeWatch(watch); + delete watch; + + // restore original value and verify spy doesn't get additional signal since watch has been removed + m_rootItem->setProperty("width", origWidth); + QTest::qWait(100); + QCOMPARE(spy.count(), 1); + + QCOMPARE(spy.at(0).at(0).value<QByteArray>(), prop.name().toUtf8()); + QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2)); +} + +void tst_QDeclarativeDebug::watch_object() +{ + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + + Q_ASSERT(q_engines->engines().count() > 0); + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + + Q_ASSERT(q_context->rootContext().objects().count() > 0); + QDeclarativeDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); + waitForQuery(q_obj); + + QDeclarativeDebugObjectReference obj = q_obj->object(); + + delete q_engines; + delete q_context; + delete q_obj; + + QDeclarativeDebugWatch *watch; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + watch = unconnected->addWatch(obj, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); + delete watch; + delete unconnected; + + watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), this); + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); + delete watch; + + watch = m_dbg->addWatch(obj, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting); + QCOMPARE(watch->objectDebugId(), obj.debugId()); + + QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); + + int origWidth = m_rootItem->property("width").toInt(); + int origHeight = m_rootItem->property("height").toInt(); + m_rootItem->setProperty("width", origWidth*2); + m_rootItem->setProperty("height", origHeight*2); + + // stateChanged() is received before any valueChanged() signals + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Active); + QVERIFY(spy.count() > 0); + + int newWidth = -1; + int newHeight = -1; + for (int i=0; i<spy.count(); i++) { + const QVariantList &values = spy[i]; + if (values[0].value<QByteArray>() == "width") + newWidth = values[1].value<QVariant>().toInt(); + else if (values[0].value<QByteArray>() == "height") + newHeight = values[1].value<QVariant>().toInt(); + + } + + m_dbg->removeWatch(watch); + delete watch; + + // since watch has been removed, restoring the original values should not trigger a valueChanged() + spy.clear(); + m_rootItem->setProperty("width", origWidth); + m_rootItem->setProperty("height", origHeight); + QTest::qWait(100); + QCOMPARE(spy.count(), 0); + + QCOMPARE(newWidth, origWidth * 2); + QCOMPARE(newHeight, origHeight * 2); +} + +void tst_QDeclarativeDebug::watch_expression() +{ + QFETCH(QString, expr); + QFETCH(int, increment); + QFETCH(int, incrementCount); + + int origWidth = m_rootItem->property("width").toInt(); + + QDeclarativeDebugObjectReference obj = findRootObject(); + + QDeclarativeDebugObjectExpressionWatch *watch; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + watch = unconnected->addWatch(obj, expr, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Dead); + delete watch; + delete unconnected; + + watch = m_dbg->addWatch(QDeclarativeDebugObjectReference(), expr, this); + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Inactive); + delete watch; + + watch = m_dbg->addWatch(obj, expr, this); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Waiting); + QCOMPARE(watch->objectDebugId(), obj.debugId()); + QCOMPARE(watch->expression(), expr); + + QSignalSpy spyState(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State))); + + QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); + int expectedSpyCount = incrementCount + 1; // should also get signal with expression's initial value + + int width = origWidth; + for (int i=0; i<incrementCount+1; i++) { + if (i > 0) { + width += increment; + m_rootItem->setProperty("width", width); + } + if (!QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(valueChanged(QByteArray,QVariant)))) + QFAIL("Did not receive valueChanged() for expression"); + } + + if (spyState.count() == 0) + QVERIFY(QDeclarativeDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QDeclarativeDebugWatch::State)))); + QCOMPARE(spyState.count(), 1); + QCOMPARE(watch->state(), QDeclarativeDebugWatch::Active); + + m_dbg->removeWatch(watch); + delete watch; + + // restore original value and verify spy doesn't get a signal since watch has been removed + m_rootItem->setProperty("width", origWidth); + QTest::qWait(100); + QCOMPARE(spy.count(), expectedSpyCount); + + width = origWidth + increment; + for (int i=0; i<spy.count(); i++) { + QCOMPARE(spy.at(i).at(1).value<QVariant>().toInt(), width); + width += increment; + } +} + +void tst_QDeclarativeDebug::watch_expression_data() +{ + QTest::addColumn<QString>("expr"); + QTest::addColumn<int>("increment"); + QTest::addColumn<int>("incrementCount"); + + QTest::newRow("width") << "width" << 0 << 0; + QTest::newRow("width+10") << "width + 10" << 10 << 5; +} + +void tst_QDeclarativeDebug::watch_context() +{ + QDeclarativeDebugContextReference c; + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeEngineDebug::addWatch(): Not implemented"); + QVERIFY(!m_dbg->addWatch(c, QString(), this)); +} + +void tst_QDeclarativeDebug::watch_file() +{ + QDeclarativeDebugFileReference f; + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeEngineDebug::addWatch(): Not implemented"); + QVERIFY(!m_dbg->addWatch(f, this)); +} + +void tst_QDeclarativeDebug::queryAvailableEngines() +{ + QDeclarativeDebugEnginesQuery *q_engines; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + q_engines = unconnected->queryAvailableEngines(0); + QCOMPARE(q_engines->state(), QDeclarativeDebugQuery::Error); + delete q_engines; + delete unconnected; + + q_engines = m_dbg->queryAvailableEngines(this); + delete q_engines; + + q_engines = m_dbg->queryAvailableEngines(this); + QVERIFY(q_engines->engines().isEmpty()); + waitForQuery(q_engines); + + // TODO test multiple engines + QList<QDeclarativeDebugEngineReference> engines = q_engines->engines(); + QCOMPARE(engines.count(), 1); + + foreach(const QDeclarativeDebugEngineReference &e, engines) { + QCOMPARE(e.debugId(), QDeclarativeDebugService::idForObject(m_engine)); + QCOMPARE(e.name(), m_engine->objectName()); + } + + delete q_engines; +} + +void tst_QDeclarativeDebug::queryRootContexts() +{ + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + int engineId = q_engines->engines()[0].debugId(); + + QDeclarativeDebugRootContextQuery *q_context; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + q_context = unconnected->queryRootContexts(engineId, this); + QCOMPARE(q_context->state(), QDeclarativeDebugQuery::Error); + delete q_context; + delete unconnected; + + q_context = m_dbg->queryRootContexts(engineId, this); + delete q_context; + + q_context = m_dbg->queryRootContexts(engineId, this); + waitForQuery(q_context); + + QDeclarativeContext *actualContext = m_engine->rootContext(); + QDeclarativeDebugContextReference context = q_context->rootContext(); + QCOMPARE(context.debugId(), QDeclarativeDebugService::idForObject(actualContext)); + QCOMPARE(context.name(), actualContext->objectName()); + + QCOMPARE(context.objects().count(), 2); // 2 qml component objects created for context in main() + + // root context query sends only root object data - it doesn't fill in + // the children or property info + QCOMPARE(context.objects()[0].properties().count(), 0); + QCOMPARE(context.objects()[0].children().count(), 0); + + QCOMPARE(context.contexts().count(), 1); + QVERIFY(context.contexts()[0].debugId() >= 0); + QCOMPARE(context.contexts()[0].name(), QString("tst_QDeclarativeDebug_childContext")); + + delete q_engines; + delete q_context; +} + +void tst_QDeclarativeDebug::queryObject() +{ + QFETCH(bool, recursive); + + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + QDeclarativeDebugObjectReference rootObject = q_context->rootContext().objects()[0]; + + QDeclarativeDebugObjectQuery *q_obj = 0; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + q_obj = recursive ? unconnected->queryObjectRecursive(rootObject, this) : unconnected->queryObject(rootObject, this); + QCOMPARE(q_obj->state(), QDeclarativeDebugQuery::Error); + delete q_obj; + delete unconnected; + + q_obj = recursive ? m_dbg->queryObjectRecursive(rootObject, this) : m_dbg->queryObject(rootObject, this); + delete q_obj; + + q_obj = recursive ? m_dbg->queryObjectRecursive(rootObject, this) : m_dbg->queryObject(rootObject, this); + waitForQuery(q_obj); + + QDeclarativeDebugObjectReference obj = q_obj->object(); + + delete q_engines; + delete q_context; + delete q_obj; + + // check source as defined in main() + QDeclarativeDebugFileReference source = obj.source(); + QCOMPARE(source.url(), QUrl::fromLocalFile("")); + QCOMPARE(source.lineNumber(), 2); + QCOMPARE(source.columnNumber(), 1); + + // generically test all properties, children and childrens' properties + recursiveObjectTest(m_rootItem, obj, recursive); + + if (recursive) { + foreach(const QDeclarativeDebugObjectReference &child, obj.children()) + QVERIFY(child.properties().count() > 0); + + QDeclarativeDebugObjectReference rect; + QDeclarativeDebugObjectReference text; + foreach (const QDeclarativeDebugObjectReference &child, obj.children()) { + if (child.className() == "Rectangle") + rect = child; + else if (child.className() == "Text") + text = child; + } + + // test specific property values + QCOMPARE(findProperty(rect.properties(), "width").value(), qVariantFromValue(500)); + QCOMPARE(findProperty(rect.properties(), "height").value(), qVariantFromValue(600)); + QCOMPARE(findProperty(rect.properties(), "color").value(), qVariantFromValue(QColor("blue"))); + + QCOMPARE(findProperty(text.properties(), "color").value(), qVariantFromValue(QColor("blue"))); + + } else { + foreach(const QDeclarativeDebugObjectReference &child, obj.children()) + QCOMPARE(child.properties().count(), 0); + } +} + +void tst_QDeclarativeDebug::queryObject_data() +{ + QTest::addColumn<bool>("recursive"); + + QTest::newRow("non-recursive") << false; + QTest::newRow("recursive") << true; +} + +void tst_QDeclarativeDebug::queryExpressionResult() +{ + QFETCH(QString, expr); + QFETCH(QVariant, result); + + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); // check immediate deletion is ok + + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + int objectId = q_context->rootContext().objects()[0].debugId(); + + QDeclarativeDebugExpressionQuery *q_expr; + + QDeclarativeEngineDebug *unconnected = new QDeclarativeEngineDebug(0); + q_expr = unconnected->queryExpressionResult(objectId, expr, this); + QCOMPARE(q_expr->state(), QDeclarativeDebugQuery::Error); + delete q_expr; + delete unconnected; + + q_expr = m_dbg->queryExpressionResult(objectId, expr, this); + delete q_expr; + + q_expr = m_dbg->queryExpressionResult(objectId, expr, this); + QCOMPARE(q_expr->expression(), expr); + waitForQuery(q_expr); + + QCOMPARE(q_expr->result(), result); + + delete q_engines; + delete q_context; + delete q_expr; +} + +void tst_QDeclarativeDebug::queryExpressionResult_data() +{ + QTest::addColumn<QString>("expr"); + QTest::addColumn<QVariant>("result"); + + QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60); + QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500); + QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>")); +} + +void tst_QDeclarativeDebug::tst_QDeclarativeDebugFileReference() +{ + QDeclarativeDebugFileReference ref; + QVERIFY(ref.url().isEmpty()); + QCOMPARE(ref.lineNumber(), -1); + QCOMPARE(ref.columnNumber(), -1); + + ref.setUrl(QUrl("http://test")); + QCOMPARE(ref.url(), QUrl("http://test")); + ref.setLineNumber(1); + QCOMPARE(ref.lineNumber(), 1); + ref.setColumnNumber(1); + QCOMPARE(ref.columnNumber(), 1); + + QDeclarativeDebugFileReference copy(ref); + QDeclarativeDebugFileReference copyAssign; + copyAssign = ref; + foreach (const QDeclarativeDebugFileReference &r, (QList<QDeclarativeDebugFileReference>() << copy << copyAssign)) { + QCOMPARE(r.url(), ref.url()); + QCOMPARE(r.lineNumber(), ref.lineNumber()); + QCOMPARE(r.columnNumber(), ref.columnNumber()); + } +} + +void tst_QDeclarativeDebug::tst_QDeclarativeDebugEngineReference() +{ + QDeclarativeDebugEngineReference ref; + QCOMPARE(ref.debugId(), -1); + QVERIFY(ref.name().isEmpty()); + + ref = QDeclarativeDebugEngineReference(1); + QCOMPARE(ref.debugId(), 1); + QVERIFY(ref.name().isEmpty()); + + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + ref = q_engines->engines()[0]; + delete q_engines; + + QDeclarativeDebugEngineReference copy(ref); + QDeclarativeDebugEngineReference copyAssign; + copyAssign = ref; + foreach (const QDeclarativeDebugEngineReference &r, (QList<QDeclarativeDebugEngineReference>() << copy << copyAssign)) { + QCOMPARE(r.debugId(), ref.debugId()); + QCOMPARE(r.name(), ref.name()); + } +} + +void tst_QDeclarativeDebug::tst_QDeclarativeDebugObjectReference() +{ + QDeclarativeDebugObjectReference ref; + QCOMPARE(ref.debugId(), -1); + QCOMPARE(ref.className(), QString()); + QCOMPARE(ref.name(), QString()); + QCOMPARE(ref.contextDebugId(), -1); + QVERIFY(ref.properties().isEmpty()); + QVERIFY(ref.children().isEmpty()); + + QDeclarativeDebugFileReference source = ref.source(); + QVERIFY(source.url().isEmpty()); + QVERIFY(source.lineNumber() < 0); + QVERIFY(source.columnNumber() < 0); + + ref = QDeclarativeDebugObjectReference(1); + QCOMPARE(ref.debugId(), 1); + + QDeclarativeDebugObjectReference rootObject = findRootObject(); + QDeclarativeDebugObjectQuery *query = m_dbg->queryObjectRecursive(rootObject, this); + waitForQuery(query); + ref = query->object(); + delete query; + + QVERIFY(ref.debugId() >= 0); + + QDeclarativeDebugObjectReference copy(ref); + QDeclarativeDebugObjectReference copyAssign; + copyAssign = ref; + foreach (const QDeclarativeDebugObjectReference &r, (QList<QDeclarativeDebugObjectReference>() << copy << copyAssign)) + recursiveCompareObjects(r, ref); +} + +void tst_QDeclarativeDebug::tst_QDeclarativeDebugContextReference() +{ + QDeclarativeDebugContextReference ref; + QCOMPARE(ref.debugId(), -1); + QVERIFY(ref.name().isEmpty()); + QVERIFY(ref.objects().isEmpty()); + QVERIFY(ref.contexts().isEmpty()); + + QDeclarativeDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); + waitForQuery(q_engines); + QDeclarativeDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); + waitForQuery(q_context); + + ref = q_context->rootContext(); + delete q_engines; + delete q_context; + QVERIFY(ref.debugId() >= 0); + + QDeclarativeDebugContextReference copy(ref); + QDeclarativeDebugContextReference copyAssign; + copyAssign = ref; + foreach (const QDeclarativeDebugContextReference &r, (QList<QDeclarativeDebugContextReference>() << copy << copyAssign)) + recursiveCompareContexts(r, ref); +} + +void tst_QDeclarativeDebug::tst_QDeclarativeDebugPropertyReference() +{ + QDeclarativeDebugObjectReference rootObject = findRootObject(); + QDeclarativeDebugObjectQuery *query = m_dbg->queryObject(rootObject, this); + waitForQuery(query); + QDeclarativeDebugObjectReference obj = query->object(); + delete query; + + QDeclarativeDebugPropertyReference ref = findProperty(obj.properties(), "scale"); + QVERIFY(ref.objectDebugId() > 0); + QVERIFY(!ref.name().isEmpty()); + QVERIFY(!ref.value().isNull()); + QVERIFY(!ref.valueTypeName().isEmpty()); + QVERIFY(!ref.binding().isEmpty()); + QVERIFY(ref.hasNotifySignal()); + + QDeclarativeDebugPropertyReference copy(ref); + QDeclarativeDebugPropertyReference copyAssign; + copyAssign = ref; + foreach (const QDeclarativeDebugPropertyReference &r, (QList<QDeclarativeDebugPropertyReference>() << copy << copyAssign)) + compareProperties(r, ref); +} + + +class tst_QDeclarativeDebug_Factory : public QDeclarativeTestFactory +{ +public: + QObject *createTest(QDeclarativeDebugTestData *data) + { + tst_QDeclarativeDebug *test = new tst_QDeclarativeDebug(data); + QDeclarativeContext *c = new QDeclarativeContext(data->engine->rootContext(), test); + c->setObjectName("tst_QDeclarativeDebug_childContext"); + return test; + } +}; + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + QList<QByteArray> qml; + qml << "import Qt 4.6\n" + "Item {" + "width: 10; height: 20; scale: blueRect.scale;" + "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" + "Text { color: blueRect.color; }" + "MouseArea {" + "onEntered: { console.log('hello') }" + "}" + "}"; + // add second component to test multiple root contexts + qml << "import Qt 4.6\n" + "Item {}"; + tst_QDeclarativeDebug_Factory factory; + return QDeclarativeDebugTest::runTests(&factory, qml); +} + +//QTEST_MAIN(tst_QDeclarativeDebug) + +#include "tst_qdeclarativedebug.moc" diff --git a/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro b/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro new file mode 100644 index 0000000..a3afd99 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebugclient/qdeclarativedebugclient.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += network declarative +macx:CONFIG -= app_bundle + +HEADERS += ../shared/debugutil_p.h +SOURCES += tst_qdeclarativedebugclient.cpp \ + ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp new file mode 100644 index 0000000..d3679a7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebugclient/tst_qdeclarativedebugclient.cpp @@ -0,0 +1,157 @@ +/**************************************************************************** +** +** 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 <QSignalSpy> +#include <QTimer> +#include <QHostAddress> +#include <QDebug> +#include <QThread> + +#include <QtDeclarative/qdeclarativeengine.h> + +#include <private/qdeclarativedebug_p.h> +#include <private/qdeclarativeenginedebug_p.h> +#include <private/qdeclarativedebugclient_p.h> +#include <private/qdeclarativedebugservice_p.h> + +#include "../shared/debugutil_p.h" + +class tst_QDeclarativeDebugClient : public QObject +{ + Q_OBJECT + +public: + tst_QDeclarativeDebugClient(QDeclarativeDebugTestData *data) + { + m_conn = data->conn; + } + + QDeclarativeDebugConnection *m_conn; + +private slots: + void name(); + void isEnabled(); + void setEnabled(); + void isConnected(); + void sendMessage(); +}; + +void tst_QDeclarativeDebugClient::name() +{ + QString name = "tst_QDeclarativeDebugClient::name()"; + + QDeclarativeDebugClient client(name, m_conn); + QCOMPARE(client.name(), name); +} + +void tst_QDeclarativeDebugClient::isEnabled() +{ + QDeclarativeDebugClient client("tst_QDeclarativeDebugClient::isEnabled()", m_conn); + QCOMPARE(client.isEnabled(), false); +} + +void tst_QDeclarativeDebugClient::setEnabled() +{ + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::setEnabled()"); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::setEnabled()", m_conn); + + QCOMPARE(service.isEnabled(), false); + + client.setEnabled(true); + QCOMPARE(client.isEnabled(), true); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); + QCOMPARE(service.isEnabled(), true); + + client.setEnabled(false); + QCOMPARE(client.isEnabled(), false); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); + QCOMPARE(service.isEnabled(), false); +} + +void tst_QDeclarativeDebugClient::isConnected() +{ + QDeclarativeDebugClient client1("tst_QDeclarativeDebugClient::isConnected() A", m_conn); + QCOMPARE(client1.isConnected(), true); + + QDeclarativeDebugConnection conn; + QDeclarativeDebugClient client2("tst_QDeclarativeDebugClient::isConnected() B", &conn); + QCOMPARE(client2.isConnected(), false); + + QDeclarativeDebugClient client3("tst_QDeclarativeDebugClient::isConnected() C", 0); + QCOMPARE(client3.isConnected(), false); + + // duplicate plugin name + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugClient: Conflicting plugin name \"tst_QDeclarativeDebugClient::isConnected() A\" "); + QDeclarativeDebugClient client4("tst_QDeclarativeDebugClient::isConnected() A", m_conn); + QCOMPARE(client4.isConnected(), false); +} + +void tst_QDeclarativeDebugClient::sendMessage() +{ + QDeclarativeDebugTestService service("tst_QDeclarativeDebugClient::sendMessage()"); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugClient::sendMessage()", m_conn); + + QByteArray msg = "hello!"; + + client.sendMessage(msg); + QByteArray resp = client.waitForResponse(); + QCOMPARE(resp, msg); +} + + +class tst_QDeclarativeDebugClient_Factory : public QDeclarativeTestFactory +{ +public: + QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugClient(data); } +}; + + +// This does not use QTEST_MAIN because the test has to be created and run +// in a separate thread. +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + tst_QDeclarativeDebugClient_Factory factory; + return QDeclarativeDebugTest::runTests(&factory); +} + +#include "tst_qdeclarativedebugclient.moc" diff --git a/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro new file mode 100644 index 0000000..e375889 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebugservice/qdeclarativedebugservice.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += network declarative +macx:CONFIG -= app_bundle + +HEADERS += ../shared/debugutil_p.h +SOURCES += tst_qdeclarativedebugservice.cpp \ + ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp new file mode 100644 index 0000000..c8fc001 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedebugservice/tst_qdeclarativedebugservice.cpp @@ -0,0 +1,190 @@ +/**************************************************************************** +** +** 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 <QSignalSpy> +#include <QTimer> +#include <QHostAddress> +#include <QDebug> +#include <QThread> + +#include <QtDeclarative/qdeclarativeengine.h> + +#include <private/qdeclarativedebug_p.h> +#include <private/qdeclarativeenginedebug_p.h> +#include <private/qdeclarativedebugclient_p.h> +#include <private/qdeclarativedebugservice_p.h> + +#include "../shared/debugutil_p.h" + +class tst_QDeclarativeDebugService : public QObject +{ + Q_OBJECT + +public: + tst_QDeclarativeDebugService(QDeclarativeDebugTestData *data) + { + m_conn = data->conn; + } + + QDeclarativeDebugConnection *m_conn; + +private slots: + void name(); + void isEnabled(); + void enabledChanged(); + void sendMessage(); + void idForObject(); + void objectForId(); + void objectToString(); +}; + +void tst_QDeclarativeDebugService::name() +{ + QString name = "tst_QDeclarativeDebugService::name()"; + + QDeclarativeDebugService service(name); + QCOMPARE(service.name(), name); +} + +void tst_QDeclarativeDebugService::isEnabled() +{ + QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::isEnabled()", m_conn); + QCOMPARE(service.isEnabled(), false); + + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::isEnabled()", m_conn); + client.setEnabled(true); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); + QCOMPARE(service.isEnabled(), true); + + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeDebugService: Conflicting plugin name \"tst_QDeclarativeDebugService::isEnabled()\" "); + QDeclarativeDebugService duplicate("tst_QDeclarativeDebugService::isEnabled()", m_conn); + QCOMPARE(duplicate.isEnabled(), false); +} + +void tst_QDeclarativeDebugService::enabledChanged() +{ + QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::enabledChanged()"); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::enabledChanged()", m_conn); + + QCOMPARE(service.enabled, false); + + client.setEnabled(true); + QDeclarativeDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); + QCOMPARE(service.enabled, true); +} + +void tst_QDeclarativeDebugService::sendMessage() +{ + QDeclarativeDebugTestService service("tst_QDeclarativeDebugService::sendMessage()"); + QDeclarativeDebugTestClient client("tst_QDeclarativeDebugService::sendMessage()", m_conn); + + QByteArray msg = "hello!"; + + client.sendMessage(msg); + QByteArray resp = client.waitForResponse(); + QCOMPARE(resp, msg); +} + +void tst_QDeclarativeDebugService::idForObject() +{ + QCOMPARE(QDeclarativeDebugService::idForObject(0), -1); + + QObject *objA = new QObject; + + int idA = QDeclarativeDebugService::idForObject(objA); + QVERIFY(idA >= 0); + QCOMPARE(QDeclarativeDebugService::objectForId(idA), objA); + + int idAA = QDeclarativeDebugService::idForObject(objA); + QCOMPARE(idAA, idA); + + QObject *objB = new QObject; + int idB = QDeclarativeDebugService::idForObject(objB); + QVERIFY(idB != idA); + QCOMPARE(QDeclarativeDebugService::objectForId(idB), objB); + + delete objA; + delete objB; +} + +void tst_QDeclarativeDebugService::objectForId() +{ + QCOMPARE(QDeclarativeDebugService::objectForId(-1), static_cast<QObject*>(0)); + QCOMPARE(QDeclarativeDebugService::objectForId(1), static_cast<QObject*>(0)); + + QObject *obj = new QObject; + int id = QDeclarativeDebugService::idForObject(obj); + QCOMPARE(QDeclarativeDebugService::objectForId(id), obj); + + delete obj; + QCOMPARE(QDeclarativeDebugService::objectForId(id), static_cast<QObject*>(0)); +} + +void tst_QDeclarativeDebugService::objectToString() +{ + QCOMPARE(QDeclarativeDebugService::objectToString(0), QString("NULL")); + + QObject *obj = new QObject; + QCOMPARE(QDeclarativeDebugService::objectToString(obj), QString("QObject: <unnamed>")); + + obj->setObjectName("Hello"); + QCOMPARE(QDeclarativeDebugService::objectToString(obj), QString("QObject: Hello")); + delete obj; +} + + +class tst_QDeclarativeDebugService_Factory : public QDeclarativeTestFactory +{ +public: + QObject *createTest(QDeclarativeDebugTestData *data) { return new tst_QDeclarativeDebugService(data); } +}; + +// This does not use QTEST_MAIN because the test has to be created and run +// in a separate thread. +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + + tst_QDeclarativeDebugService_Factory factory; + return QDeclarativeDebugTest::runTests(&factory); +} + +#include "tst_qdeclarativedebugservice.moc" diff --git a/tests/auto/declarative/qmldom/data/MyComponent.qml b/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml index 1472f01..1472f01 100644 --- a/tests/auto/declarative/qmldom/data/MyComponent.qml +++ b/tests/auto/declarative/qdeclarativedom/data/MyComponent.qml diff --git a/tests/auto/declarative/qmldom/data/MyItem.qml b/tests/auto/declarative/qdeclarativedom/data/MyItem.qml index 1472f01..1472f01 100644 --- a/tests/auto/declarative/qmldom/data/MyItem.qml +++ b/tests/auto/declarative/qdeclarativedom/data/MyItem.qml diff --git a/tests/auto/declarative/qmldom/data/importdir/Bar.qml b/tests/auto/declarative/qdeclarativedom/data/importdir/Bar.qml index 2d1a4a3..2d1a4a3 100644 --- a/tests/auto/declarative/qmldom/data/importdir/Bar.qml +++ b/tests/auto/declarative/qdeclarativedom/data/importdir/Bar.qml diff --git a/tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir/Foo.qml index 2d1a4a3..2d1a4a3 100644 --- a/tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml +++ b/tests/auto/declarative/qdeclarativedom/data/importlib/sublib/qmldir/Foo.qml diff --git a/tests/auto/declarative/qmldom/data/top.qml b/tests/auto/declarative/qdeclarativedom/data/top.qml index 2681993..2681993 100644 --- a/tests/auto/declarative/qmldom/data/top.qml +++ b/tests/auto/declarative/qdeclarativedom/data/top.qml diff --git a/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro new file mode 100644 index 0000000..35df26e --- /dev/null +++ b/tests/auto/declarative/qdeclarativedom/qdeclarativedom.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativedom.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp new file mode 100644 index 0000000..9543280 --- /dev/null +++ b/tests/auto/declarative/qdeclarativedom/tst_qdeclarativedom.cpp @@ -0,0 +1,1313 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/private/qdeclarativedom_p.h> + +#include <QtCore/QDebug> +#include <QtCore/QFile> + +class tst_qdeclarativedom : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativedom() {} + +private slots: + void loadSimple(); + void loadProperties(); + void loadGroupedProperties(); + void loadChildObject(); + void loadComposite(); + void loadImports(); + void loadErrors(); + void loadSyntaxErrors(); + void loadRemoteErrors(); + void loadDynamicProperty(); + void loadComponent(); + + void testValueSource(); + void testValueInterceptor(); + + void object_dynamicProperty(); + void object_property(); + void object_url(); + + void copy(); + void position(); +private: + QDeclarativeEngine engine; +}; + + +void tst_qdeclarativedom::loadSimple() +{ + QByteArray qml = "import Qt 4.6\n" + "Item {}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + QVERIFY(document.errors().isEmpty()); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + QVERIFY(!rootObject.isComponent()); + QVERIFY(!rootObject.isCustomType()); + QVERIFY(rootObject.objectType() == "Qt/Item"); + QVERIFY(rootObject.objectTypeMajorVersion() == 4); + QVERIFY(rootObject.objectTypeMinorVersion() == 6); +} + +// Test regular properties +void tst_qdeclarativedom::loadProperties() +{ + QByteArray qml = "import Qt 4.6\n" + "Item { id : item; x : 300; visible : true }"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + QVERIFY(rootObject.objectId() == "item"); + QCOMPARE(rootObject.properties().size(), 3); + + QDeclarativeDomProperty xProperty = rootObject.property("x"); + QVERIFY(xProperty.propertyName() == "x"); + QCOMPARE(xProperty.propertyNameParts().count(), 1); + QVERIFY(xProperty.propertyNameParts().at(0) == "x"); + QCOMPARE(xProperty.position(), 32); + QCOMPARE(xProperty.length(), 1); + QVERIFY(xProperty.value().isLiteral()); + QVERIFY(xProperty.value().toLiteral().literal() == "300"); + + QDeclarativeDomProperty visibleProperty = rootObject.property("visible"); + QVERIFY(visibleProperty.propertyName() == "visible"); + QCOMPARE(visibleProperty.propertyNameParts().count(), 1); + QVERIFY(visibleProperty.propertyNameParts().at(0) == "visible"); + QCOMPARE(visibleProperty.position(), 41); + QCOMPARE(visibleProperty.length(), 7); + QVERIFY(visibleProperty.value().isLiteral()); + QVERIFY(visibleProperty.value().toLiteral().literal() == "true"); +} + +// Test grouped properties +void tst_qdeclarativedom::loadGroupedProperties() +{ + { + QByteArray qml = "import Qt 4.6\n" + "Item { anchors.left: parent.left; anchors.right: parent.right }"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QVERIFY(rootItem.properties().size() == 2); + + // Order is not deterministic + QDeclarativeDomProperty p0 = rootItem.properties().at(0); + QDeclarativeDomProperty p1 = rootItem.properties().at(1); + QDeclarativeDomProperty leftProperty; + QDeclarativeDomProperty rightProperty; + if (p0.propertyName() == "anchors.left") { + leftProperty = p0; + rightProperty = p1; + } else { + leftProperty = p1; + rightProperty = p0; + } + + QVERIFY(leftProperty.propertyName() == "anchors.left"); + QCOMPARE(leftProperty.propertyNameParts().count(), 2); + QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); + QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); + QCOMPARE(leftProperty.position(), 21); + QCOMPARE(leftProperty.length(), 12); + QVERIFY(leftProperty.value().isBinding()); + QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); + + QVERIFY(rightProperty.propertyName() == "anchors.right"); + QCOMPARE(rightProperty.propertyNameParts().count(), 2); + QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); + QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); + QCOMPARE(rightProperty.position(), 48); + QCOMPARE(rightProperty.length(), 13); + QVERIFY(rightProperty.value().isBinding()); + QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); + } + + { + QByteArray qml = "import Qt 4.6\n" + "Item { \n" + " anchors {\n" + " left: parent.left\n" + " right: parent.right\n" + " }\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QVERIFY(rootItem.properties().size() == 2); + + // Order is not deterministic + QDeclarativeDomProperty p0 = rootItem.properties().at(0); + QDeclarativeDomProperty p1 = rootItem.properties().at(1); + QDeclarativeDomProperty leftProperty; + QDeclarativeDomProperty rightProperty; + if (p0.propertyName() == "anchors.left") { + leftProperty = p0; + rightProperty = p1; + } else { + leftProperty = p1; + rightProperty = p0; + } + + QVERIFY(leftProperty.propertyName() == "anchors.left"); + QCOMPARE(leftProperty.propertyNameParts().count(), 2); + QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); + QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); + QCOMPARE(leftProperty.position(), 44); + QCOMPARE(leftProperty.length(), 4); + QVERIFY(leftProperty.value().isBinding()); + QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); + + QVERIFY(rightProperty.propertyName() == "anchors.right"); + QCOMPARE(rightProperty.propertyNameParts().count(), 2); + QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); + QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); + QCOMPARE(rightProperty.position(), 70); + QCOMPARE(rightProperty.length(), 5); + QVERIFY(rightProperty.value().isBinding()); + QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); + } + +} + +void tst_qdeclarativedom::loadChildObject() +{ + QByteArray qml = "import Qt 4.6\n" + "Item { Item {} }"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QVERIFY(rootItem.properties().size() == 1); + + QDeclarativeDomProperty listProperty = rootItem.properties().at(0); + QVERIFY(listProperty.isDefaultProperty()); + QVERIFY(listProperty.value().isList()); + + QDeclarativeDomList list = listProperty.value().toList(); + QVERIFY(list.values().size() == 1); + + QDeclarativeDomObject childItem = list.values().first().toObject(); + QVERIFY(childItem.isValid()); + QVERIFY(childItem.objectType() == "Qt/Item"); +} + +void tst_qdeclarativedom::loadComposite() +{ + QFile file(SRCDIR "/data/top.qml"); + QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, file.readAll(), QUrl::fromLocalFile(file.fileName()))); + QVERIFY(document.errors().isEmpty()); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QCOMPARE(rootItem.objectType(), QByteArray("MyComponent")); + QCOMPARE(rootItem.properties().size(), 2); + + QDeclarativeDomProperty widthProperty = rootItem.property("width"); + QVERIFY(widthProperty.value().isLiteral()); + + QDeclarativeDomProperty heightProperty = rootItem.property("height"); + QVERIFY(heightProperty.value().isLiteral()); +} + +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); }}"; + + QDeclarativeEngine freshEngine; + QDeclarativeDomDocument document; + QVERIFY(document.load(&freshEngine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QDeclarativeDomProperty heightProperty = rootItem.properties().at(0); + QVERIFY(heightProperty.propertyName() == "height"); + QVERIFY(heightProperty.value().isValueSource()); + + const QDeclarativeDomValueValueSource valueSource = heightProperty.value().toValueSource(); + QDeclarativeDomObject valueSourceObject = valueSource.object(); + QVERIFY(valueSourceObject.isValid()); + + QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); + + const QDeclarativeDomValue springValue = valueSourceObject.property("spring").value(); + QVERIFY(!springValue.isInvalid()); + QVERIFY(springValue.isLiteral()); + QVERIFY(springValue.toLiteral().literal() == "1.4"); + + const QDeclarativeDomValue sourceValue = valueSourceObject.property("source").value(); + QVERIFY(!sourceValue.isInvalid()); + QVERIFY(sourceValue.isBinding()); + QVERIFY(sourceValue.toBinding().binding() == "Math.min(Math.max(-130, value*2.2 - 130), 133)"); +} + +void tst_qdeclarativedom::testValueInterceptor() +{ + QByteArray qml = "import Qt 4.6\n" + "Rectangle { height: Behavior { NumberAnimation { duration: 100 } } }"; + + QDeclarativeEngine freshEngine; + QDeclarativeDomDocument document; + QVERIFY(document.load(&freshEngine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QDeclarativeDomProperty heightProperty = rootItem.properties().at(0); + QVERIFY(heightProperty.propertyName() == "height"); + QVERIFY(heightProperty.value().isValueInterceptor()); + + const QDeclarativeDomValueValueInterceptor valueInterceptor = heightProperty.value().toValueInterceptor(); + QDeclarativeDomObject valueInterceptorObject = valueInterceptor.object(); + QVERIFY(valueInterceptorObject.isValid()); + + QVERIFY(valueInterceptorObject.objectType() == "Qt/Behavior"); + + const QDeclarativeDomValue animationValue = valueInterceptorObject.property("animation").value(); + QVERIFY(!animationValue.isInvalid()); + QVERIFY(animationValue.isObject()); +} + +// Test QDeclarativeDomDocument::imports() +void tst_qdeclarativedom::loadImports() +{ + QByteArray qml = "import Qt 4.6\n" + "import importlib.sublib 4.7\n" + "import importlib.sublib 4.6 as NewFoo\n" + "import 'import'\n" + "import 'import' as X\n" + "Item {}"; + + QDeclarativeEngine engine; + engine.addImportPath(SRCDIR "/data"); + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QCOMPARE(document.imports().size(), 5); + + QDeclarativeDomImport import = document.imports().at(0); + QCOMPARE(import.type(), QDeclarativeDomImport::Library); + QCOMPARE(import.uri(), QLatin1String("Qt")); + QCOMPARE(import.qualifier(), QString()); + QCOMPARE(import.version(), QLatin1String("4.6")); + + import = document.imports().at(1); + QCOMPARE(import.type(), QDeclarativeDomImport::Library); + QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); + QCOMPARE(import.qualifier(), QString()); + QCOMPARE(import.version(), QLatin1String("4.7")); + + import = document.imports().at(2); + QCOMPARE(import.type(), QDeclarativeDomImport::Library); + QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); + QCOMPARE(import.qualifier(), QLatin1String("NewFoo")); + QCOMPARE(import.version(), QLatin1String("4.6")); + + import = document.imports().at(3); + QCOMPARE(import.type(), QDeclarativeDomImport::File); + QCOMPARE(import.uri(), QLatin1String("import")); + QCOMPARE(import.qualifier(), QLatin1String("")); + QCOMPARE(import.version(), QLatin1String("")); + + import = document.imports().at(4); + QCOMPARE(import.type(), QDeclarativeDomImport::File); + QCOMPARE(import.uri(), QLatin1String("import")); + QCOMPARE(import.qualifier(), QLatin1String("X")); + QCOMPARE(import.version(), QLatin1String("")); +} + +// Test loading a file with errors +void tst_qdeclarativedom::loadErrors() +{ + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " foo: 12\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(false == document.load(&engine, qml)); + + QCOMPARE(document.errors().count(), 1); + QDeclarativeError error = document.errors().first(); + + QCOMPARE(error.url(), QUrl()); + QCOMPARE(error.line(), 3); + QCOMPARE(error.column(), 3); + QCOMPARE(error.description(), QString("Cannot assign to non-existent property \"foo\"")); +} + +// Test loading a file with syntax errors +void tst_qdeclarativedom::loadSyntaxErrors() +{ + QByteArray qml = "import Qt 4.6\n" + "asdf"; + + QDeclarativeDomDocument document; + QVERIFY(false == document.load(&engine, qml)); + + QCOMPARE(document.errors().count(), 1); + QDeclarativeError error = document.errors().first(); + + QCOMPARE(error.url(), QUrl()); + QCOMPARE(error.line(), 2); + QCOMPARE(error.column(), 1); + QCOMPARE(error.description(), QString("Syntax error")); +} + +// Test attempting to load a file with remote references +void tst_qdeclarativedom::loadRemoteErrors() +{ + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " Script {\n" + " source: \"http://localhost/exampleQmlScript.js\"" + " }\n" + "}"; + QDeclarativeDomDocument document; + QVERIFY(false == document.load(&engine, qml)); + + QCOMPARE(document.errors().count(), 1); + QDeclarativeError error = document.errors().first(); + + QCOMPARE(error.url(), QUrl()); + QCOMPARE(error.line(), -1); + QCOMPARE(error.column(), -1); + QCOMPARE(error.description(), QString("QDeclarativeDomDocument supports local types only")); +} + +// Test dynamic property declarations +void tst_qdeclarativedom::loadDynamicProperty() +{ + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " property int a\n" + " property bool b\n" + " property double c\n" + " property real d\n" + " property string e\n" + " property url f\n" + " property color g\n" + " property date h\n" + " property var i\n" + " property variant j\n" + " property QtObject k\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QCOMPARE(rootObject.dynamicProperties().count(), 11); + +#define DP_TEST(index, name, type, test_position, test_length, propTypeName) \ + { \ + QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(index); \ + QVERIFY(d.isValid()); \ + QVERIFY(d.propertyName() == # name ); \ + QVERIFY(d.propertyType() == type); \ + QVERIFY(d.propertyTypeName() == propTypeName); \ + QVERIFY(d.isDefaultProperty() == false); \ + QVERIFY(d.defaultValue().isValid() == false); \ + QCOMPARE(d.position(), test_position); \ + QCOMPARE(d.length(), test_length); \ + } \ + + DP_TEST(0, a, QVariant::Int, 25, 14, "int"); + DP_TEST(1, b, QVariant::Bool, 44, 15, "bool"); + DP_TEST(2, c, QVariant::Double, 64, 17, "double"); + DP_TEST(3, d, QMetaType::QReal, 86, 15, "real"); + DP_TEST(4, e, QVariant::String, 106, 17, "string"); + DP_TEST(5, f, QVariant::Url, 128, 14, "url"); + DP_TEST(6, g, QVariant::Color, 147, 16, "color"); + DP_TEST(7, h, QVariant::Date, 168, 15, "date"); + DP_TEST(8, i, qMetaTypeId<QVariant>(), 188, 14, "var"); + DP_TEST(9, j, qMetaTypeId<QVariant>(), 207, 18, "variant"); + DP_TEST(10, k, -1, 230, 19, "QtObject"); + } + + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " property int a: 12\n" + " property int b: a + 6\n" + " default property QtObject c\n" + "}\n"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QCOMPARE(rootObject.dynamicProperties().count(), 3); + + { + QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(0); + QVERIFY(d.isDefaultProperty() == false); + QVERIFY(d.defaultValue().isValid()); + QVERIFY(d.defaultValue().propertyName() == "a"); + QVERIFY(d.defaultValue().value().isLiteral()); + } + + { + QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(1); + QVERIFY(d.isDefaultProperty() == false); + QVERIFY(d.defaultValue().isValid()); + QVERIFY(d.defaultValue().propertyName() == "b"); + QVERIFY(d.defaultValue().value().isBinding()); + } + + { + QDeclarativeDomDynamicProperty d = rootObject.dynamicProperties().at(2); + QVERIFY(d.isDefaultProperty() == true); + QVERIFY(d.defaultValue().isValid() == false); + } + } +} + +// Test inline components +void tst_qdeclarativedom::loadComponent() +{ + // Explicit component + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " Component {\n" + " id: myComponent\n" + " Item {}\n" + " }\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QVERIFY(rootItem.properties().size() == 1); + + QDeclarativeDomProperty listProperty = rootItem.properties().at(0); + QVERIFY(listProperty.isDefaultProperty()); + QVERIFY(listProperty.value().isList()); + + QDeclarativeDomList list = listProperty.value().toList(); + QVERIFY(list.values().size() == 1); + + QDeclarativeDomObject componentObject = list.values().first().toObject(); + QVERIFY(componentObject.isValid()); + QVERIFY(componentObject.objectClassName() == "Component"); + QVERIFY(componentObject.isComponent()); + + QDeclarativeDomComponent component = componentObject.toComponent(); + QVERIFY(component.isValid()); + QVERIFY(component.objectType() == "Qt/Component"); + QVERIFY(component.objectTypeMajorVersion() == 4); + QVERIFY(component.objectTypeMinorVersion() == 6); + QVERIFY(component.objectClassName() == "Component"); + QVERIFY(component.objectId() == "myComponent"); + QVERIFY(component.properties().isEmpty()); + QVERIFY(component.dynamicProperties().isEmpty()); + QVERIFY(component.isCustomType() == false); + QVERIFY(component.customTypeData() == ""); + QVERIFY(component.isComponent()); + QCOMPARE(component.position(), 25); + QCOMPARE(component.length(), 57); + + QVERIFY(component.componentRoot().isValid()); + QVERIFY(component.componentRoot().objectClassName() == "Item"); + } + + // Implicit component + { + QByteArray qml = "import Qt 4.6\n" + "ListView {\n" + " delegate: Item {}\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootItem = document.rootObject(); + QVERIFY(rootItem.isValid()); + QVERIFY(rootItem.properties().size() == 1); + + QDeclarativeDomProperty delegate = rootItem.property("delegate"); + + QDeclarativeDomObject componentObject = delegate.value().toObject(); + QVERIFY(componentObject.isValid()); + QVERIFY(componentObject.objectClassName() == "Component"); + QVERIFY(componentObject.isComponent()); + + QDeclarativeDomComponent component = componentObject.toComponent(); + QVERIFY(component.isValid()); + QVERIFY(component.objectType() == "Qt/Component"); + QVERIFY(component.objectClassName() == "Component"); + QVERIFY(component.objectId() == ""); + QVERIFY(component.properties().isEmpty()); + QVERIFY(component.dynamicProperties().isEmpty()); + QVERIFY(component.isCustomType() == false); + QVERIFY(component.customTypeData() == ""); + QVERIFY(component.isComponent()); + QCOMPARE(component.position(), 39); + QCOMPARE(component.length(), 7); + + QVERIFY(component.componentRoot().isValid()); + QVERIFY(component.componentRoot().objectClassName() == "Item"); + } +} + +// Test QDeclarativeDomObject::dynamicProperty() method +void tst_qdeclarativedom::object_dynamicProperty() +{ + // Invalid object + { + QDeclarativeDomObject object; + QVERIFY(object.dynamicProperty("").isValid() == false); + QVERIFY(object.dynamicProperty("foo").isValid() == false); + } + + + // Valid object, no dynamic properties + { + QByteArray qml = "import Qt 4.6\n" + "Item {}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QVERIFY(rootObject.dynamicProperty("").isValid() == false); + QVERIFY(rootObject.dynamicProperty("foo").isValid() == false); + } + + // Valid object, dynamic properties + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " property int a\n" + "}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QVERIFY(rootObject.dynamicProperty("").isValid() == false); + QVERIFY(rootObject.dynamicProperty("foo").isValid() == false); + + QDeclarativeDomDynamicProperty p = rootObject.dynamicProperty("a"); + QVERIFY(p.isValid()); + QVERIFY(p.propertyName() == "a"); + QVERIFY(p.propertyType() == QVariant::Int); + QVERIFY(p.propertyTypeName() == "int"); + QVERIFY(p.isDefaultProperty() == false); + QCOMPARE(p.position(), 25); + QCOMPARE(p.length(), 14); + } + +} + +// Test QDeclarativeObject::property() method +void tst_qdeclarativedom::object_property() +{ + // Invalid object + { + QDeclarativeDomObject object; + QVERIFY(object.property("").isValid() == false); + QVERIFY(object.property("foo").isValid() == false); + } + + // Valid object - no default + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " x: 10\n" + " y: 12\n" + "}\n"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QVERIFY(rootObject.property("").isValid() == false); + QVERIFY(rootObject.property("foo").isValid() == false); + + QDeclarativeDomProperty x = rootObject.property("x"); + QVERIFY(x.isValid()); + QVERIFY(x.propertyName() == "x"); + QVERIFY(x.propertyNameParts().count() == 1); + QVERIFY(x.propertyNameParts().at(0) == "x"); + QVERIFY(x.isDefaultProperty() == false); + QVERIFY(x.value().isLiteral()); + QVERIFY(x.value().toLiteral().literal() == "10"); + QCOMPARE(x.position(), 25); + QCOMPARE(x.length(), 1); + + QDeclarativeDomProperty y = rootObject.property("y"); + QVERIFY(y.isValid()); + QVERIFY(y.propertyName() == "y"); + QVERIFY(y.propertyNameParts().count() == 1); + QVERIFY(y.propertyNameParts().at(0) == "y"); + QVERIFY(y.isDefaultProperty() == false); + QVERIFY(y.value().isLiteral()); + QVERIFY(y.value().toLiteral().literal() == "12"); + QCOMPARE(y.position(), 35); + QCOMPARE(y.length(), 1); + } + + // Valid object - with default + { + QByteArray qml = "import Qt 4.6\n" + "Item {\n" + " x: 10\n" + " y: 12\n" + " Item {}\n" + "}\n"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + + QVERIFY(rootObject.property("").isValid() == false); + QVERIFY(rootObject.property("foo").isValid() == false); + + QDeclarativeDomProperty x = rootObject.property("x"); + QVERIFY(x.isValid()); + QVERIFY(x.propertyName() == "x"); + QVERIFY(x.propertyNameParts().count() == 1); + QVERIFY(x.propertyNameParts().at(0) == "x"); + QVERIFY(x.isDefaultProperty() == false); + QVERIFY(x.value().isLiteral()); + QVERIFY(x.value().toLiteral().literal() == "10"); + QCOMPARE(x.position(), 25); + QCOMPARE(x.length(), 1); + + QDeclarativeDomProperty y = rootObject.property("y"); + QVERIFY(y.isValid()); + QVERIFY(y.propertyName() == "y"); + QVERIFY(y.propertyNameParts().count() == 1); + QVERIFY(y.propertyNameParts().at(0) == "y"); + QVERIFY(y.isDefaultProperty() == false); + QVERIFY(y.value().isLiteral()); + QVERIFY(y.value().toLiteral().literal() == "12"); + QCOMPARE(y.position(), 35); + QCOMPARE(y.length(), 1); + + QDeclarativeDomProperty data = rootObject.property("data"); + QVERIFY(data.isValid()); + QVERIFY(data.propertyName() == "data"); + QVERIFY(data.propertyNameParts().count() == 1); + QVERIFY(data.propertyNameParts().at(0) == "data"); + QVERIFY(data.isDefaultProperty() == true); + QVERIFY(data.value().isList()); + QCOMPARE(data.position(), 45); + QCOMPARE(data.length(), 0); + } +} + +// Tests the QDeclarativeDomObject::url() method +void tst_qdeclarativedom::object_url() +{ + // Invalid object + { + QDeclarativeDomObject object; + QCOMPARE(object.url(), QUrl()); + } + + // Valid builtin object + { + QByteArray qml = "import Qt 4.6\n" + "Item {}"; + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + QCOMPARE(rootObject.url(), QUrl()); + } + + // Valid composite object + { + QByteArray qml = "import Qt 4.6\n" + "MyItem {}"; + + QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); + QUrl subUrl = QUrl::fromLocalFile(SRCDIR "/data/MyItem.qml"); + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml, myUrl)); + + QDeclarativeDomObject rootObject = document.rootObject(); + QVERIFY(rootObject.isValid()); + QCOMPARE(rootObject.url(), subUrl); + } +} + +// Test copy constructors and operators +void tst_qdeclarativedom::copy() +{ + QByteArray qml = "import Qt 4.6\n" + "MyItem {\n" + " id: myItem\n" + " property int a: 10\n" + " x: 10\n" + " y: x + 10\n" + " z: NumberAnimation {}\n" + " opacity: Behavior {}\n" + " Component {\n" + " Item{}\n" + " }\n" + " children: [ Item{}, Item{} ]\n" + "}\n"; + + QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml, myUrl)); + + // QDeclarativeDomDocument + { + QDeclarativeDomDocument document2(document); + QDeclarativeDomDocument document3; + document3 = document; + + QCOMPARE(document.imports().count(), document2.imports().count()); + QCOMPARE(document.errors().count(), document2.errors().count()); + QCOMPARE(document.rootObject().objectClassName(), document2.rootObject().objectClassName()); + + QCOMPARE(document.imports().count(), document3.imports().count()); + QCOMPARE(document.errors().count(), document3.errors().count()); + QCOMPARE(document.rootObject().objectClassName(), document3.rootObject().objectClassName()); + } + + // QDeclarativeDomImport + { + QCOMPARE(document.imports().count(), 1); + QDeclarativeDomImport import = document.imports().at(0); + + QDeclarativeDomImport import2(import); + QDeclarativeDomImport import3; + import3 = import2; + + QCOMPARE(import.type(), import2.type()); + QCOMPARE(import.uri(), import2.uri()); + QCOMPARE(import.version(), import2.version()); + QCOMPARE(import.qualifier(), import2.qualifier()); + + QCOMPARE(import.type(), import3.type()); + QCOMPARE(import.uri(), import3.uri()); + QCOMPARE(import.version(), import3.version()); + QCOMPARE(import.qualifier(), import3.qualifier()); + } + + // QDeclarativeDomObject + { + QDeclarativeDomObject object = document.rootObject(); + QVERIFY(object.isValid()); + + QDeclarativeDomObject object2(object); + QDeclarativeDomObject object3; + object3 = object; + + QCOMPARE(object.isValid(), object2.isValid()); + QCOMPARE(object.objectType(), object2.objectType()); + QCOMPARE(object.objectClassName(), object2.objectClassName()); + QCOMPARE(object.objectTypeMajorVersion(), object2.objectTypeMajorVersion()); + QCOMPARE(object.objectTypeMinorVersion(), object2.objectTypeMinorVersion()); + QCOMPARE(object.objectId(), object2.objectId()); + QCOMPARE(object.properties().count(), object2.properties().count()); + QCOMPARE(object.dynamicProperties().count(), object2.dynamicProperties().count()); + QCOMPARE(object.isCustomType(), object2.isCustomType()); + QCOMPARE(object.customTypeData(), object2.customTypeData()); + QCOMPARE(object.isComponent(), object2.isComponent()); + QCOMPARE(object.position(), object2.position()); + QCOMPARE(object.length(), object2.length()); + QCOMPARE(object.url(), object2.url()); + + QCOMPARE(object.isValid(), object3.isValid()); + QCOMPARE(object.objectType(), object3.objectType()); + QCOMPARE(object.objectClassName(), object3.objectClassName()); + QCOMPARE(object.objectTypeMajorVersion(), object3.objectTypeMajorVersion()); + QCOMPARE(object.objectTypeMinorVersion(), object3.objectTypeMinorVersion()); + QCOMPARE(object.objectId(), object3.objectId()); + QCOMPARE(object.properties().count(), object3.properties().count()); + QCOMPARE(object.dynamicProperties().count(), object3.dynamicProperties().count()); + QCOMPARE(object.isCustomType(), object3.isCustomType()); + QCOMPARE(object.customTypeData(), object3.customTypeData()); + QCOMPARE(object.isComponent(), object3.isComponent()); + QCOMPARE(object.position(), object3.position()); + QCOMPARE(object.length(), object3.length()); + QCOMPARE(object.url(), object3.url()); + } + + // QDeclarativeDomDynamicProperty + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomDynamicProperty property = object.dynamicProperty("a"); + + QDeclarativeDomDynamicProperty property2(property); + QDeclarativeDomDynamicProperty property3; + property3 = property; + + QCOMPARE(property.isValid(), property2.isValid()); + QCOMPARE(property.propertyName(), property2.propertyName()); + QCOMPARE(property.propertyType(), property2.propertyType()); + QCOMPARE(property.propertyTypeName(), property2.propertyTypeName()); + QCOMPARE(property.isDefaultProperty(), property2.isDefaultProperty()); + QCOMPARE(property.defaultValue().propertyName(), property2.defaultValue().propertyName()); + QCOMPARE(property.position(), property2.position()); + QCOMPARE(property.length(), property2.length()); + + QCOMPARE(property.isValid(), property3.isValid()); + QCOMPARE(property.propertyName(), property3.propertyName()); + QCOMPARE(property.propertyType(), property3.propertyType()); + QCOMPARE(property.propertyTypeName(), property3.propertyTypeName()); + QCOMPARE(property.isDefaultProperty(), property3.isDefaultProperty()); + QCOMPARE(property.defaultValue().propertyName(), property3.defaultValue().propertyName()); + QCOMPARE(property.position(), property3.position()); + QCOMPARE(property.length(), property3.length()); + } + + // QDeclarativeDomProperty + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("opacity"); + + QDeclarativeDomProperty property2(property); + QDeclarativeDomProperty property3; + property3 = property; + + QCOMPARE(property.isValid(), property2.isValid()); + QCOMPARE(property.propertyName(), property2.propertyName()); + QCOMPARE(property.propertyNameParts(), property2.propertyNameParts()); + QCOMPARE(property.isDefaultProperty(), property2.isDefaultProperty()); + QCOMPARE(property.value().type(), property2.value().type()); + QCOMPARE(property.position(), property2.position()); + QCOMPARE(property.length(), property2.length()); + + QCOMPARE(property.isValid(), property3.isValid()); + QCOMPARE(property.propertyName(), property3.propertyName()); + QCOMPARE(property.propertyNameParts(), property3.propertyNameParts()); + QCOMPARE(property.isDefaultProperty(), property3.isDefaultProperty()); + QCOMPARE(property.value().type(), property3.value().type()); + QCOMPARE(property.position(), property3.position()); + QCOMPARE(property.length(), property3.length()); + } + + // QDeclarativeDomValueLiteral + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("x"); + QDeclarativeDomValueLiteral literal = property.value().toLiteral(); + QCOMPARE(literal.literal(), QString("10")); + + QDeclarativeDomValueLiteral literal2(literal); + QDeclarativeDomValueLiteral literal3; + literal3 = literal2; + + QCOMPARE(literal2.literal(), QString("10")); + QCOMPARE(literal3.literal(), QString("10")); + } + + + // QDeclarativeDomValueBinding + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("y"); + QDeclarativeDomValueBinding binding = property.value().toBinding(); + QCOMPARE(binding.binding(), QString("x + 10")); + + QDeclarativeDomValueBinding binding2(binding); + QDeclarativeDomValueBinding binding3; + binding3 = binding2; + + QCOMPARE(binding2.binding(), QString("x + 10")); + QCOMPARE(binding3.binding(), QString("x + 10")); + } + + // QDeclarativeDomValueValueSource + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("z"); + QDeclarativeDomValueValueSource source = property.value().toValueSource(); + QCOMPARE(source.object().objectClassName(), QByteArray("NumberAnimation")); + + QDeclarativeDomValueValueSource source2(source); + QDeclarativeDomValueValueSource source3; + source3 = source; + + QCOMPARE(source2.object().objectClassName(), QByteArray("NumberAnimation")); + QCOMPARE(source3.object().objectClassName(), QByteArray("NumberAnimation")); + } + + // QDeclarativeDomValueValueInterceptor + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("opacity"); + QDeclarativeDomValueValueInterceptor interceptor = property.value().toValueInterceptor(); + QCOMPARE(interceptor.object().objectClassName(), QByteArray("Behavior")); + + QDeclarativeDomValueValueInterceptor interceptor2(interceptor); + QDeclarativeDomValueValueInterceptor interceptor3; + interceptor3 = interceptor; + + QCOMPARE(interceptor2.object().objectClassName(), QByteArray("Behavior")); + QCOMPARE(interceptor3.object().objectClassName(), QByteArray("Behavior")); + } + + // QDeclarativeDomComponent + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("data"); + QCOMPARE(property.value().toList().values().count(), 1); + QDeclarativeDomComponent component = + property.value().toList().values().at(0).toObject().toComponent(); + QCOMPARE(component.componentRoot().objectClassName(), QByteArray("Item")); + + QDeclarativeDomComponent component2(component); + QDeclarativeDomComponent component3; + component3 = component; + + QCOMPARE(component.componentRoot().objectClassName(), component2.componentRoot().objectClassName()); + QCOMPARE(component.isValid(), component2.isValid()); + QCOMPARE(component.objectType(), component2.objectType()); + QCOMPARE(component.objectClassName(), component2.objectClassName()); + QCOMPARE(component.objectTypeMajorVersion(), component2.objectTypeMajorVersion()); + QCOMPARE(component.objectTypeMinorVersion(), component2.objectTypeMinorVersion()); + QCOMPARE(component.objectId(), component2.objectId()); + QCOMPARE(component.properties().count(), component2.properties().count()); + QCOMPARE(component.dynamicProperties().count(), component2.dynamicProperties().count()); + QCOMPARE(component.isCustomType(), component2.isCustomType()); + QCOMPARE(component.customTypeData(), component2.customTypeData()); + QCOMPARE(component.isComponent(), component2.isComponent()); + QCOMPARE(component.position(), component2.position()); + QCOMPARE(component.length(), component2.length()); + QCOMPARE(component.url(), component2.url()); + + QCOMPARE(component.componentRoot().objectClassName(), component3.componentRoot().objectClassName()); + QCOMPARE(component.isValid(), component3.isValid()); + QCOMPARE(component.objectType(), component3.objectType()); + QCOMPARE(component.objectClassName(), component3.objectClassName()); + QCOMPARE(component.objectTypeMajorVersion(), component3.objectTypeMajorVersion()); + QCOMPARE(component.objectTypeMinorVersion(), component3.objectTypeMinorVersion()); + QCOMPARE(component.objectId(), component3.objectId()); + QCOMPARE(component.properties().count(), component3.properties().count()); + QCOMPARE(component.dynamicProperties().count(), component3.dynamicProperties().count()); + QCOMPARE(component.isCustomType(), component3.isCustomType()); + QCOMPARE(component.customTypeData(), component3.customTypeData()); + QCOMPARE(component.isComponent(), component3.isComponent()); + QCOMPARE(component.position(), component3.position()); + QCOMPARE(component.length(), component3.length()); + QCOMPARE(component.url(), component3.url()); + } + + // QDeclarativeDomValue + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("data"); + QDeclarativeDomValue value = property.value(); + + QDeclarativeDomValue value2(value); + QDeclarativeDomValue value3; + value3 = value; + + QCOMPARE(value.type(), value2.type()); + QCOMPARE(value.isInvalid(), value2.isInvalid()); + QCOMPARE(value.isLiteral(), value2.isLiteral()); + QCOMPARE(value.isBinding(), value2.isBinding()); + QCOMPARE(value.isValueSource(), value2.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); + QCOMPARE(value.isObject(), value2.isObject()); + QCOMPARE(value.isList(), value2.isList()); + QCOMPARE(value.position(), value2.position()); + QCOMPARE(value.length(), value2.length()); + + QCOMPARE(value.type(), value3.type()); + QCOMPARE(value.isInvalid(), value3.isInvalid()); + QCOMPARE(value.isLiteral(), value3.isLiteral()); + QCOMPARE(value.isBinding(), value3.isBinding()); + QCOMPARE(value.isValueSource(), value3.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); + QCOMPARE(value.isObject(), value3.isObject()); + QCOMPARE(value.isList(), value3.isList()); + QCOMPARE(value.position(), value3.position()); + QCOMPARE(value.length(), value3.length()); + } + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("x"); + QDeclarativeDomValue value = property.value(); + + QDeclarativeDomValue value2(value); + QDeclarativeDomValue value3; + value3 = value; + + QCOMPARE(value.type(), value2.type()); + QCOMPARE(value.isInvalid(), value2.isInvalid()); + QCOMPARE(value.isLiteral(), value2.isLiteral()); + QCOMPARE(value.isBinding(), value2.isBinding()); + QCOMPARE(value.isValueSource(), value2.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); + QCOMPARE(value.isObject(), value2.isObject()); + QCOMPARE(value.isList(), value2.isList()); + QCOMPARE(value.position(), value2.position()); + QCOMPARE(value.length(), value2.length()); + + QCOMPARE(value.type(), value3.type()); + QCOMPARE(value.isInvalid(), value3.isInvalid()); + QCOMPARE(value.isLiteral(), value3.isLiteral()); + QCOMPARE(value.isBinding(), value3.isBinding()); + QCOMPARE(value.isValueSource(), value3.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); + QCOMPARE(value.isObject(), value3.isObject()); + QCOMPARE(value.isList(), value3.isList()); + QCOMPARE(value.position(), value3.position()); + QCOMPARE(value.length(), value3.length()); + } + { + QDeclarativeDomValue value; + + QDeclarativeDomValue value2(value); + QDeclarativeDomValue value3; + value3 = value; + + QCOMPARE(value.type(), value2.type()); + QCOMPARE(value.isInvalid(), value2.isInvalid()); + QCOMPARE(value.isLiteral(), value2.isLiteral()); + QCOMPARE(value.isBinding(), value2.isBinding()); + QCOMPARE(value.isValueSource(), value2.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); + QCOMPARE(value.isObject(), value2.isObject()); + QCOMPARE(value.isList(), value2.isList()); + QCOMPARE(value.position(), value2.position()); + QCOMPARE(value.length(), value2.length()); + + QCOMPARE(value.type(), value3.type()); + QCOMPARE(value.isInvalid(), value3.isInvalid()); + QCOMPARE(value.isLiteral(), value3.isLiteral()); + QCOMPARE(value.isBinding(), value3.isBinding()); + QCOMPARE(value.isValueSource(), value3.isValueSource()); + QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); + QCOMPARE(value.isObject(), value3.isObject()); + QCOMPARE(value.isList(), value3.isList()); + QCOMPARE(value.position(), value3.position()); + QCOMPARE(value.length(), value3.length()); + } + + // QDeclarativeDomList + { + QDeclarativeDomObject object = document.rootObject(); + QDeclarativeDomProperty property = object.property("children"); + QDeclarativeDomList list = property.value().toList(); + QCOMPARE(list.values().count(), 2); + + QDeclarativeDomList list2(list); + QDeclarativeDomList list3; + list3 = list2; + + QCOMPARE(list.values().count(), list2.values().count()); + QCOMPARE(list.position(), list2.position()); + QCOMPARE(list.length(), list2.length()); + QCOMPARE(list.commaPositions(), list2.commaPositions()); + + QCOMPARE(list.values().count(), list3.values().count()); + QCOMPARE(list.position(), list3.position()); + QCOMPARE(list.length(), list3.length()); + QCOMPARE(list.commaPositions(), list3.commaPositions()); + + } +} + +// Tests the position/length of various elements +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"; + + + QDeclarativeDomDocument document; + QVERIFY(document.load(&engine, qml)); + + QDeclarativeDomObject root = document.rootObject(); + + // All QDeclarativeDomDynamicProperty + QDeclarativeDomDynamicProperty dynProp = root.dynamicProperty("a"); + QCOMPARE(dynProp.position(), 40); + QCOMPARE(dynProp.length(), 18); + + // All QDeclarativeDomProperty + QDeclarativeDomProperty x = root.property("x"); + QCOMPARE(x.position(), 63); + QCOMPARE(x.length(), 1); + + QDeclarativeDomProperty y = root.property("y"); + QCOMPARE(y.position(), 73); + QCOMPARE(y.length(), 1); + + QDeclarativeDomProperty z = root.property("z"); + QCOMPARE(z.position(), 87); + QCOMPARE(z.length(), 1); + + QDeclarativeDomProperty opacity = root.property("opacity"); + QCOMPARE(opacity.position(), 113); + QCOMPARE(opacity.length(), 7); + + QDeclarativeDomProperty data = root.property("data"); + QCOMPARE(data.position(), 138); + QCOMPARE(data.length(), 0); + + QDeclarativeDomProperty children = root.property("children"); + QCOMPARE(children.position(), 175); + QCOMPARE(children.length(), 8); + + QDeclarativeDomList dataList = data.value().toList(); + QCOMPARE(dataList.values().count(), 1); + QDeclarativeDomList childrenList = children.value().toList(); + QCOMPARE(childrenList.values().count(), 2); + + // All QDeclarativeDomObject + QCOMPARE(root.position(), 14); + QCOMPARE(root.length(), 191); + + QDeclarativeDomObject numberAnimation = z.value().toValueSource().object(); + QCOMPARE(numberAnimation.position(), 90); + QCOMPARE(numberAnimation.length(), 18); + + QDeclarativeDomObject behavior = opacity.value().toValueInterceptor().object(); + QCOMPARE(behavior.position(), 122); + QCOMPARE(behavior.length(), 11); + + QDeclarativeDomObject component = dataList.values().at(0).toObject(); + QCOMPARE(component.position(), 138); + QCOMPARE(component.length(), 32); + + QDeclarativeDomObject componentRoot = component.toComponent().componentRoot(); + QCOMPARE(componentRoot.position(), 158); + QCOMPARE(componentRoot.length(), 6); + + QDeclarativeDomObject child1 = childrenList.values().at(0).toObject(); + QCOMPARE(child1.position(), 187); + QCOMPARE(child1.length(), 6); + + QDeclarativeDomObject child2 = childrenList.values().at(1).toObject(); + QCOMPARE(child2.position(), 195); + QCOMPARE(child2.length(), 6); + + // All QDeclarativeDomValue + QDeclarativeDomValue xValue = x.value(); + QCOMPARE(xValue.position(), 66); + QCOMPARE(xValue.length(), 2); + + QDeclarativeDomValue yValue = y.value(); + QCOMPARE(yValue.position(), 76); + QCOMPARE(yValue.length(), 6); + + QDeclarativeDomValue zValue = z.value(); + QCOMPARE(zValue.position(), 90); + QCOMPARE(zValue.length(), 18); + + QDeclarativeDomValue opacityValue = opacity.value(); + QCOMPARE(opacityValue.position(), 122); + QCOMPARE(opacityValue.length(), 11); + + QDeclarativeDomValue dataValue = data.value(); + QCOMPARE(dataValue.position(), 138); + QCOMPARE(dataValue.length(), 32); + + QDeclarativeDomValue child1Value = childrenList.values().at(0); + QCOMPARE(child1Value.position(), 187); + QCOMPARE(child1Value.length(), 6); + + QDeclarativeDomValue child2Value = childrenList.values().at(1); + QCOMPARE(child2Value.position(), 195); + QCOMPARE(child2Value.length(), 6); + + // All QDeclarativeDomList + qWarning("QDeclarativeListValue position test required"); +} + +QTEST_MAIN(tst_qdeclarativedom) + +#include "tst_qdeclarativedom.moc" diff --git a/tests/auto/declarative/qmleasefollow/data/easefollow1.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml index 0cc19eb..0cc19eb 100644 --- a/tests/auto/declarative/qmleasefollow/data/easefollow1.qml +++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow1.qml diff --git a/tests/auto/declarative/qmleasefollow/data/easefollow2.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml index b65964e..b65964e 100644 --- a/tests/auto/declarative/qmleasefollow/data/easefollow2.qml +++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow2.qml diff --git a/tests/auto/declarative/qmleasefollow/data/easefollow3.qml b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml index f8886e9..f8886e9 100644 --- a/tests/auto/declarative/qmleasefollow/data/easefollow3.qml +++ b/tests/auto/declarative/qdeclarativeeasefollow/data/easefollow3.qml diff --git a/tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro b/tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro new file mode 100644 index 0000000..71df4f4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeeasefollow/qdeclarativeeasefollow.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeeasefollow.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp b/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp new file mode 100644 index 0000000..036eec0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeeasefollow/tst_qdeclarativeeasefollow.cpp @@ -0,0 +1,122 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeeasefollow_p.h> +#include <private/qdeclarativevaluetype_p.h> +#include "../../../shared/util.h" + +class tst_qdeclarativeeasefollow : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeeasefollow(); + +private slots: + void defaultValues(); + void values(); + void disabled(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeeasefollow::tst_qdeclarativeeasefollow() +{ +} + +void tst_qdeclarativeeasefollow::defaultValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow1.qml")); + QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 0.); + QCOMPARE(obj->velocity(), 200.); + QCOMPARE(obj->enabled(), true); + QCOMPARE(obj->duration(), -1.); + QCOMPARE(obj->maximumEasingTime(), -1.); + QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Eased); + + delete obj; +} + +void tst_qdeclarativeeasefollow::values() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow2.qml")); + QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 10.); + QCOMPARE(obj->velocity(), 200.); + QCOMPARE(obj->enabled(), true); + QCOMPARE(obj->duration(), 300.); + QCOMPARE(obj->maximumEasingTime(), -1.); + QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Immediate); + + delete obj; +} + +void tst_qdeclarativeeasefollow::disabled() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow3.qml")); + QDeclarativeEaseFollow *obj = qobject_cast<QDeclarativeEaseFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 10.); + QCOMPARE(obj->velocity(), 250.); + QCOMPARE(obj->enabled(), false); + QCOMPARE(obj->maximumEasingTime(), 150.); + QCOMPARE(obj->reversingMode(), QDeclarativeEaseFollow::Sync); + + delete obj; +} + +QTEST_MAIN(tst_qdeclarativeeasefollow) + +#include "tst_qdeclarativeeasefollow.moc" diff --git a/tests/auto/declarative/qmlecmascript/data/ConstantsOverrideBindings.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml index b4a702b..b4a702b 100644 --- a/tests/auto/declarative/qmlecmascript/data/ConstantsOverrideBindings.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ConstantsOverrideBindings.qml diff --git a/tests/auto/declarative/qmlecmascript/data/CustomObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml index 691d9ec..691d9ec 100644 --- a/tests/auto/declarative/qmlecmascript/data/CustomObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/CustomObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/MethodsObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml index f51ca86..f51ca86 100644 --- a/tests/auto/declarative/qmlecmascript/data/MethodsObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/MethodsObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml index 7c32e56..7c32e56 100644 --- a/tests/auto/declarative/qmlecmascript/data/NestedTypeTransientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/NestedTypeTransientErrors.qml diff --git a/tests/auto/declarative/qmlecmascript/data/ScopeObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml index b7bec63..b7bec63 100644 --- a/tests/auto/declarative/qmlecmascript/data/ScopeObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/ScopeObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/TypeForDynamicCreation.qml b/tests/auto/declarative/qdeclarativeecmascript/data/TypeForDynamicCreation.qml index 56e0625..56e0625 100644 --- a/tests/auto/declarative/qmlecmascript/data/TypeForDynamicCreation.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/TypeForDynamicCreation.qml diff --git a/tests/auto/declarative/qmlecmascript/data/aliasPropertyAndBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml index 5c3ea1f..5c3ea1f 100644 --- a/tests/auto/declarative/qmlecmascript/data/aliasPropertyAndBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/aliasPropertyAndBinding.qml diff --git a/tests/auto/declarative/qmlecmascript/data/assignBasicTypes.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml index db7f2b5..db7f2b5 100644 --- a/tests/auto/declarative/qmlecmascript/data/assignBasicTypes.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml index 128db69..128db69 100644 --- a/tests/auto/declarative/qmlecmascript/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/assignBasicTypes.qml diff --git a/tests/auto/declarative/qmlecmascript/data/attachedProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.qml index 061eda0..061eda0 100644 --- a/tests/auto/declarative/qmlecmascript/data/attachedProperty.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/attachedProperty.qml diff --git a/tests/auto/declarative/qmlecmascript/data/bindingLoop.qml b/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml index 80545cf..80545cf 100644 --- a/tests/auto/declarative/qmlecmascript/data/bindingLoop.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/bindingLoop.qml diff --git a/tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml index 3147f63..3147f63 100644 --- a/tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml index c89bb49..c89bb49 100644 --- a/tests/auto/declarative/qmlecmascript/data/boolPropertiesEvaluateAsBool.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/boolPropertiesEvaluateAsBool.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/bug.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml index 266de76..266de76 100644 --- a/tests/auto/declarative/qmlecmascript/data/bug.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/bug.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml b/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml index 80a2814..80a2814 100644 --- a/tests/auto/declarative/qmlecmascript/data/compositePropertyType.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/compositePropertyType.qml diff --git a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.1.qml index 13c5ae5..13c5ae5 100644 --- a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml index 207a06b..207a06b 100644 --- a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.3.qml index ca9d1d8..ca9d1d8 100644 --- a/tests/auto/declarative/qmlecmascript/data/constantsOverrideBindings.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/constantsOverrideBindings.3.qml diff --git a/tests/auto/declarative/qmlecmascript/data/qmlToString.qml b/tests/auto/declarative/qdeclarativeecmascript/data/declarativeToString.qml index ac296ce..ac296ce 100644 --- a/tests/auto/declarative/qmlecmascript/data/qmlToString.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/declarativeToString.qml diff --git a/tests/auto/declarative/qmlecmascript/data/deferredProperties.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deferredProperties.qml index e01f708..e01f708 100644 --- a/tests/auto/declarative/qmlecmascript/data/deferredProperties.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deferredProperties.qml diff --git a/tests/auto/declarative/qmlecmascript/data/deletedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml index 6bc3a17..6bc3a17 100644 --- a/tests/auto/declarative/qmlecmascript/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/deletedObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.helper.qml index d790d63..d790d63 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.helper.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.helper.qml diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml index ed5e571..ed5e571 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicCreation.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicCreation.qml diff --git a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicDeletion.qml index 0855b29..0855b29 100644 --- a/tests/auto/declarative/qmlecmascript/data/dynamicDeletion.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/dynamicDeletion.qml diff --git a/tests/auto/declarative/qmlecmascript/data/enums.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/enums.1.qml index 6351823..6351823 100644 --- a/tests/auto/declarative/qmlecmascript/data/enums.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/enums.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/enums.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/enums.2.qml index bdc672f..bdc672f 100644 --- a/tests/auto/declarative/qmlecmascript/data/enums.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/enums.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionClearsOnReeval.qml b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionClearsOnReeval.qml index a2f0d1a..a2f0d1a 100644 --- a/tests/auto/declarative/qmlecmascript/data/exceptionClearsOnReeval.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionClearsOnReeval.qml diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml index acc3163..acc3163 100644 --- a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning.qml diff --git a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml index 44e10c1..44e10c1 100644 --- a/tests/auto/declarative/qmlecmascript/data/exceptionProducesWarning2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/exceptionProducesWarning2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/extendedObjectPropertyLookup.qml b/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml index 9a82ad1..9a82ad1 100644 --- a/tests/auto/declarative/qmlecmascript/data/extendedObjectPropertyLookup.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/extendedObjectPropertyLookup.qml diff --git a/tests/auto/declarative/qmlecmascript/data/extensionObjects.qml b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml index a902312..a902312 100644 --- a/tests/auto/declarative/qmlecmascript/data/extensionObjects.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/extensionObjects.qml diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml index 2ac7b6e..2ac7b6e 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.2.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js index 78c3a86..78c3a86 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.2.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.js diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml index dec657c..dec657c 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml index d7acf38..d7acf38 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.3.qml diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml index 16211aa..16211aa 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.4.qml diff --git a/tests/auto/declarative/qmlecmascript/data/externalScript.js b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js index 8928652..8928652 100644 --- a/tests/auto/declarative/qmlecmascript/data/externalScript.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/externalScript.js diff --git a/tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml index 2db0fc6..2db0fc6 100644 --- a/tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.qml b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml index f66428d..f66428d 100644 --- a/tests/auto/declarative/qmlecmascript/data/idShortcutInvalidates.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/idShortcutInvalidates.qml diff --git a/tests/auto/declarative/qmlecmascript/data/jsObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml index 4128c92..4128c92 100644 --- a/tests/auto/declarative/qmlecmascript/data/jsObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/jsObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/listProperties.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml index 810f9b6..810f9b6 100644 --- a/tests/auto/declarative/qmlecmascript/data/listProperties.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listProperties.qml diff --git a/tests/auto/declarative/qmlecmascript/data/listToVariant.qml b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml index 47f4e50..47f4e50 100644 --- a/tests/auto/declarative/qmlecmascript/data/listToVariant.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/listToVariant.qml diff --git a/tests/auto/declarative/qmlecmascript/data/methods.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml index 0bbee16..0bbee16 100644 --- a/tests/auto/declarative/qmlecmascript/data/methods.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/methods.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml index 9f0c6b1..9f0c6b1 100644 --- a/tests/auto/declarative/qmlecmascript/data/methods.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/methods.3.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml index 79efc50..79efc50 100644 --- a/tests/auto/declarative/qmlecmascript/data/methods.3.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.3.qml diff --git a/tests/auto/declarative/qmlecmascript/data/methods.4.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml index aac711c..aac711c 100644 --- a/tests/auto/declarative/qmlecmascript/data/methods.4.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.4.qml diff --git a/tests/auto/declarative/qmlecmascript/data/methods.5.qml b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml index 3d45b15..3d45b15 100644 --- a/tests/auto/declarative/qmlecmascript/data/methods.5.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/methods.5.qml diff --git a/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml index 7da09e4..7da09e4 100644 --- a/tests/auto/declarative/qmlecmascript/data/multiEngineObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/multiEngineObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml b/tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml index f9585db..f9585db 100644 --- a/tests/auto/declarative/qmlecmascript/data/nonExistantAttachedObject.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/nonExistantAttachedObject.qml diff --git a/tests/auto/declarative/qmlecmascript/data/objectsCompareAsEqual.qml b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml index 18e488a..18e488a 100644 --- a/tests/auto/declarative/qmlecmascript/data/objectsCompareAsEqual.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/objectsCompareAsEqual.qml diff --git a/tests/auto/declarative/qmlecmascript/data/outerBindingOverridesInnerBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml index 0a933e8..0a933e8 100644 --- a/tests/auto/declarative/qmlecmascript/data/outerBindingOverridesInnerBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/outerBindingOverridesInnerBinding.qml diff --git a/tests/auto/declarative/qmlecmascript/data/scope.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml index 8e5aa0b..8e5aa0b 100644 --- a/tests/auto/declarative/qmlecmascript/data/scope.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/scope.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml index cccd3d3..cccd3d3 100644 --- a/tests/auto/declarative/qmlecmascript/data/scope.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scope.qml diff --git a/tests/auto/declarative/qmlecmascript/data/scriptAccess.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js index c00d285..c00d285 100644 --- a/tests/auto/declarative/qmlecmascript/data/scriptAccess.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.js diff --git a/tests/auto/declarative/qmlecmascript/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml index feb6d16..feb6d16 100644 --- a/tests/auto/declarative/qmlecmascript/data/scriptAccess.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptAccess.qml diff --git a/tests/auto/declarative/qmlecmascript/data/scriptErrors.js b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js index 1d7b357..1d7b357 100644 --- a/tests/auto/declarative/qmlecmascript/data/scriptErrors.js +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.js diff --git a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml index c2edb41..c2edb41 100644 --- a/tests/auto/declarative/qmlecmascript/data/scriptErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/scriptErrors.qml diff --git a/tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml index 58cf805..58cf805 100644 --- a/tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.qml b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.qml index 074851a..074851a 100644 --- a/tests/auto/declarative/qmlecmascript/data/selfDeletingBinding.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/selfDeletingBinding.qml diff --git a/tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml index 5a19639..5a19639 100644 --- a/tests/auto/declarative/qmlecmascript/data/shutdownErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/shutdownErrors.qml diff --git a/tests/auto/declarative/qmlecmascript/data/signalAssignment.1.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml index fbd0914..fbd0914 100644 --- a/tests/auto/declarative/qmlecmascript/data/signalAssignment.1.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.1.qml diff --git a/tests/auto/declarative/qmlecmascript/data/signalAssignment.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml index 8addcb9..8addcb9 100644 --- a/tests/auto/declarative/qmlecmascript/data/signalAssignment.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalAssignment.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/signalParameterTypes.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml index 6fc8b02..6fc8b02 100644 --- a/tests/auto/declarative/qmlecmascript/data/signalParameterTypes.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalParameterTypes.qml diff --git a/tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml index 7d419cd..7d419cd 100644 --- a/tests/auto/declarative/qmlecmascript/data/signalTriggeredBindings.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/signalTriggeredBindings.qml diff --git a/tests/auto/declarative/qmlecmascript/data/transientErrors.qml b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml index fa7e01c..fa7e01c 100644 --- a/tests/auto/declarative/qmlecmascript/data/transientErrors.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/transientErrors.qml diff --git a/tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.2.qml b/tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.2.qml index e73d38e2..e73d38e2 100644 --- a/tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.2.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.2.qml diff --git a/tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.qml b/tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.qml index eceff60..eceff60 100644 --- a/tests/auto/declarative/qmlecmascript/data/undefinedResetsProperty.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/undefinedResetsProperty.qml diff --git a/tests/auto/declarative/qmlecmascript/data/valueTypeFunctions.qml b/tests/auto/declarative/qdeclarativeecmascript/data/valueTypeFunctions.qml index 33b4a68..33b4a68 100644 --- a/tests/auto/declarative/qmlecmascript/data/valueTypeFunctions.qml +++ b/tests/auto/declarative/qdeclarativeecmascript/data/valueTypeFunctions.qml diff --git a/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro new file mode 100644 index 0000000..0e21cb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/qdeclarativeecmascript.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeecmascript.cpp \ + testtypes.cpp +HEADERS += testtypes.h + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp new file mode 100644 index 0000000..6a04704 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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" + +class BaseExtensionObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); +public: + BaseExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} + + int extendedProperty() const { return m_value; } + void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); } + +signals: + void extendedPropertyChanged(); +private: + int m_value; +}; + +class ExtensionObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); +public: + ExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} + + int extendedProperty() const { return m_value; } + void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); } + +signals: + void extendedPropertyChanged(); +private: + int m_value; +}; + +void registerTypes() +{ + QML_REGISTER_TYPE(Qt.test, 1,0, MyQmlObject,MyQmlObject); + QML_REGISTER_TYPE(Qt.test, 1,0, MyDeferredObject,MyDeferredObject); + QML_REGISTER_TYPE(Qt.test, 1,0, MyQmlContainer,MyQmlContainer); + QML_REGISTER_EXTENDED_TYPE(Qt.test, 1,0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject); + QML_REGISTER_EXTENDED_TYPE(Qt.test, 1,0, MyExtendedObject,MyExtendedObject,ExtensionObject); + QML_REGISTER_TYPE(Qt.test, 1,0, MyTypeObject, MyTypeObject); +} + +#include "testtypes.moc" diff --git a/tests/auto/declarative/qdeclarativeecmascript/testtypes.h b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h new file mode 100644 index 0000000..8fbd071 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/testtypes.h @@ -0,0 +1,598 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <QtCore/qobject.h> +#include <QtDeclarative/qdeclarative.h> +#include <QtDeclarative/qdeclarativeexpression.h> +#include <QtCore/qpoint.h> +#include <QtCore/qsize.h> +#include <QtDeclarative/qdeclarativelist.h> +#include <QtCore/qrect.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qcolor.h> +#include <QtGui/qvector3d.h> +#include <QtCore/qdatetime.h> +#include <QtScript/qscriptvalue.h> +#include <QtDeclarative/qdeclarativescriptstring.h> +#include <QtDeclarative/qdeclarativecomponent.h> + +class MyQmlAttachedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value CONSTANT) +public: + MyQmlAttachedObject(QObject *parent) : QObject(parent) {} + + int value() const { return 19; } +}; + +class MyQmlObject : public QObject +{ + Q_OBJECT + Q_ENUMS(MyEnum) + Q_ENUMS(MyEnum2) + Q_PROPERTY(int deleteOnSet READ deleteOnSet WRITE setDeleteOnSet) + Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT) + Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT) + Q_PROPERTY(int value READ value WRITE setValue) + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged) + Q_PROPERTY(QDeclarativeListProperty<QObject> objectListProperty READ objectListProperty CONSTANT) + Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) + +public: + MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} + + enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 }; + enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 }; + + bool trueProperty() const { return true; } + bool falseProperty() const { return false; } + + QString stringProperty() const { return m_string; } + void setStringProperty(const QString &s) + { + if (s == m_string) + return; + m_string = s; + emit stringChanged(); + } + + QObject *objectProperty() const { return m_object; } + void setObjectProperty(QObject *obj) { + if (obj == m_object) + return; + m_object = obj; + emit objectChanged(); + } + + QDeclarativeListProperty<QObject> objectListProperty() { return QDeclarativeListProperty<QObject>(this, m_objectQList); } + + bool methodCalled() const { return m_methodCalled; } + bool methodIntCalled() const { return m_methodIntCalled; } + + QString string() const { return m_string; } + + static MyQmlAttachedObject *qmlAttachedProperties(QObject *o) { + return new MyQmlAttachedObject(o); + } + + int deleteOnSet() const { return 1; } + void setDeleteOnSet(int v) { if(v) delete this; } + + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + + int resettableProperty() const { return m_resetProperty; } + void setResettableProperty(int v) { m_resetProperty = v; } + void resetProperty() { m_resetProperty = 13; } + +signals: + void basicSignal(); + void argumentSignal(int a, QString b, qreal c); + void stringChanged(); + void objectChanged(); + void anotherBasicSignal(); + void thirdBasicSignal(); + +public slots: + void deleteMe() { delete this; } + void methodNoArgs() { m_methodCalled = true; } + void method(int a) { if(a == 163) m_methodIntCalled = true; } + void setString(const QString &s) { m_string = s; } + +private: + friend class tst_qdeclarativeecmascript; + bool m_methodCalled; + bool m_methodIntCalled; + + QObject *m_object; + QString m_string; + QList<QObject *> m_objectQList; + int m_value; + int m_resetProperty; +}; + +QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(MyQmlObject); + +class MyQmlContainer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<MyQmlObject> children READ children CONSTANT) +public: + MyQmlContainer() {} + + QDeclarativeListProperty<MyQmlObject> children() { return QDeclarativeListProperty<MyQmlObject>(this, m_children); } + +private: + QList<MyQmlObject*> m_children; +}; + +QML_DECLARE_TYPE(MyQmlContainer); + +class MyExpression : public QDeclarativeExpression +{ + Q_OBJECT +public: + MyExpression(QDeclarativeContext *ctxt, const QString &expr) + : QDeclarativeExpression(ctxt, expr, 0), changed(false) + { + QObject::connect(this, SIGNAL(valueChanged()), this, SLOT(expressionValueChanged())); + setNotifyOnValueChanged(true); + } + + bool changed; + +public slots: + void expressionValueChanged() { + changed = true; + } +}; + + +class MyDefaultObject1 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int horseLegs READ horseLegs CONSTANT); + Q_PROPERTY(int antLegs READ antLegs CONSTANT); +public: + int horseLegs() const { return 4; } + int antLegs() const { return 6; } +}; + +class MyDefaultObject2 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs CONSTANT); + Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); +public: + int antLegs() const { return 5; } // Had an accident + int emuLegs() const { return 2; } +}; + +class MyDefaultObject3 : public QObject +{ + Q_OBJECT + Q_PROPERTY(int antLegs READ antLegs CONSTANT); + Q_PROPERTY(int humanLegs READ humanLegs CONSTANT); +public: + int antLegs() const { return 7; } // Mutant + int humanLegs() const { return 2; } + int millipedeLegs() const { return 1000; } +}; + +class MyDeferredObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); + Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2); + Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2"); + +public: + MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {} + + int value() const { return m_value; } + void setValue(int v) { m_value = v; emit valueChanged(); } + + QObject *objectProperty() const { return m_object; } + void setObjectProperty(QObject *obj) { m_object = obj; } + + QObject *objectProperty2() const { return m_object2; } + void setObjectProperty2(QObject *obj) { m_object2 = obj; } + +signals: + void valueChanged(); + +private: + int m_value; + QObject *m_object; + QObject *m_object2; +}; +QML_DECLARE_TYPE(MyDeferredObject); + +class MyBaseExtendedObject : public QObject +{ +Q_OBJECT +Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty); +public: + MyBaseExtendedObject() : m_value(0) {} + + int baseProperty() const { return m_value; } + void setBaseProperty(int v) { m_value = v; } + +private: + int m_value; +}; +QML_DECLARE_TYPE(MyBaseExtendedObject); + +class MyExtendedObject : public MyBaseExtendedObject +{ +Q_OBJECT +Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty); +public: + MyExtendedObject() : m_value(0) {} + + int coreProperty() const { return m_value; } + void setCoreProperty(int v) { m_value = v; } + +private: + int m_value; +}; +QML_DECLARE_TYPE(MyExtendedObject); + +class MyTypeObject : public QObject +{ + Q_OBJECT + Q_ENUMS(MyEnum) + Q_FLAGS(MyFlags) + + Q_PROPERTY(QString id READ id WRITE setId); + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); + +public: + MyTypeObject() + : objectPropertyValue(0), componentPropertyValue(0) {} + + QString idValue; + QString id() const { + return idValue; + } + void setId(const QString &v) { + idValue = v; + } + + QObject *objectPropertyValue; + QObject *objectProperty() const { + return objectPropertyValue; + } + void setObjectProperty(QObject *v) { + objectPropertyValue = v; + } + + QDeclarativeComponent *componentPropertyValue; + QDeclarativeComponent *componentProperty() const { + return componentPropertyValue; + } + void setComponentProperty(QDeclarativeComponent *v) { + componentPropertyValue = v; + } + + enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 }; + Q_DECLARE_FLAGS(MyFlags, MyFlag) + MyFlags flagPropertyValue; + MyFlags flagProperty() const { + return flagPropertyValue; + } + void setFlagProperty(MyFlags v) { + flagPropertyValue = v; + } + + enum MyEnum { EnumVal1, EnumVal2 }; + MyEnum enumPropertyValue; + MyEnum enumProperty() const { + return enumPropertyValue; + } + void setEnumProperty(MyEnum v) { + enumPropertyValue = v; + } + + QString stringPropertyValue; + QString stringProperty() const { + return stringPropertyValue; + } + void setStringProperty(const QString &v) { + stringPropertyValue = v; + } + + uint uintPropertyValue; + uint uintProperty() const { + return uintPropertyValue; + } + void setUintProperty(const uint &v) { + uintPropertyValue = v; + } + + int intPropertyValue; + int intProperty() const { + return intPropertyValue; + } + void setIntProperty(const int &v) { + intPropertyValue = v; + } + + qreal realPropertyValue; + qreal realProperty() const { + return realPropertyValue; + } + void setRealProperty(const qreal &v) { + realPropertyValue = v; + } + + double doublePropertyValue; + double doubleProperty() const { + return doublePropertyValue; + } + void setDoubleProperty(const double &v) { + doublePropertyValue = v; + } + + float floatPropertyValue; + float floatProperty() const { + return floatPropertyValue; + } + void setFloatProperty(const float &v) { + floatPropertyValue = v; + } + + QColor colorPropertyValue; + QColor colorProperty() const { + return colorPropertyValue; + } + void setColorProperty(const QColor &v) { + colorPropertyValue = v; + } + + QDate datePropertyValue; + QDate dateProperty() const { + return datePropertyValue; + } + void setDateProperty(const QDate &v) { + datePropertyValue = v; + } + + QTime timePropertyValue; + QTime timeProperty() const { + return timePropertyValue; + } + void setTimeProperty(const QTime &v) { + timePropertyValue = v; + } + + QDateTime dateTimePropertyValue; + QDateTime dateTimeProperty() const { + return dateTimePropertyValue; + } + void setDateTimeProperty(const QDateTime &v) { + dateTimePropertyValue = v; + } + + QPoint pointPropertyValue; + QPoint pointProperty() const { + return pointPropertyValue; + } + void setPointProperty(const QPoint &v) { + pointPropertyValue = v; + } + + QPointF pointFPropertyValue; + QPointF pointFProperty() const { + return pointFPropertyValue; + } + void setPointFProperty(const QPointF &v) { + pointFPropertyValue = v; + } + + QSize sizePropertyValue; + QSize sizeProperty() const { + return sizePropertyValue; + } + void setSizeProperty(const QSize &v) { + sizePropertyValue = v; + } + + QSizeF sizeFPropertyValue; + QSizeF sizeFProperty() const { + return sizeFPropertyValue; + } + void setSizeFProperty(const QSizeF &v) { + sizeFPropertyValue = v; + } + + QRect rectPropertyValue; + QRect rectProperty() const { + return rectPropertyValue; + } + void setRectProperty(const QRect &v) { + rectPropertyValue = v; + emit rectPropertyChanged(); + } + + QRect rectPropertyValue2; + QRect rectProperty2() const { + return rectPropertyValue2; + } + void setRectProperty2(const QRect &v) { + rectPropertyValue2 = v; + } + + QRectF rectFPropertyValue; + QRectF rectFProperty() const { + return rectFPropertyValue; + } + void setRectFProperty(const QRectF &v) { + rectFPropertyValue = v; + } + + bool boolPropertyValue; + bool boolProperty() const { + return boolPropertyValue; + } + void setBoolProperty(const bool &v) { + boolPropertyValue = v; + } + + QVariant variantPropertyValue; + QVariant variantProperty() const { + return variantPropertyValue; + } + void setVariantProperty(const QVariant &v) { + variantPropertyValue = v; + } + + QVector3D vectorPropertyValue; + QVector3D vectorProperty() const { + return vectorPropertyValue; + } + void setVectorProperty(const QVector3D &v) { + vectorPropertyValue = v; + } + + QUrl urlPropertyValue; + QUrl urlProperty() const { + return urlPropertyValue; + } + void setUrlProperty(const QUrl &v) { + urlPropertyValue = v; + } + + QDeclarativeScriptString scriptPropertyValue; + QDeclarativeScriptString scriptProperty() const { + return scriptPropertyValue; + } + void setScriptProperty(const QDeclarativeScriptString &v) { + scriptPropertyValue = v; + } + + void doAction() { emit action(); } +signals: + void action(); + void rectPropertyChanged(); +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) +QML_DECLARE_TYPE(MyTypeObject); + +Q_DECLARE_METATYPE(QScriptValue); +class MyInvokableObject : public QObject +{ + Q_OBJECT +public: + MyInvokableObject() { reset(); } + + int invoked() const { return m_invoked; } + bool error() const { return m_invokedError; } + const QVariantList &actuals() const { return m_actuals; } + void reset() { m_invoked = -1; m_invokedError = false; m_actuals.clear(); } + + Q_INVOKABLE QPointF method_get_QPointF() { return QPointF(99.3, -10.2); } + Q_INVOKABLE QPoint method_get_QPoint() { return QPoint(9, 12); } + + Q_INVOKABLE void method_NoArgs() { invoke(0); } + Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; } + Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.7; } + Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); } + Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; } + Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; } + Q_INVOKABLE QScriptValue method_NoArgs_QScriptValue() { invoke(6); return QScriptValue("Hello world"); } + Q_INVOKABLE QVariant method_NoArgs_QVariant() { invoke(7); return QVariant("QML rocks"); } + + Q_INVOKABLE void method_int(int a) { invoke(8); m_actuals << a; } + Q_INVOKABLE void method_intint(int a, int b) { invoke(9); m_actuals << a << b; } + Q_INVOKABLE void method_real(qreal a) { invoke(10); m_actuals << a; } + Q_INVOKABLE void method_QString(QString a) { invoke(11); m_actuals << a; } + Q_INVOKABLE void method_QPointF(QPointF a) { invoke(12); m_actuals << a; } + Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); } + Q_INVOKABLE void method_QScriptValue(QScriptValue a) { invoke(14); m_actuals << qVariantFromValue(a); } + Q_INVOKABLE void method_intQScriptValue(int a, QScriptValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } + + Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } + Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } + +private: + void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;} + int m_invoked; + bool m_invokedError; + QVariantList m_actuals; +}; + +void registerTypes(); + +#endif // TESTTYPES_H + diff --git a/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp new file mode 100644 index 0000000..60c380c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeecmascript/tst_qdeclarativeecmascript.cpp @@ -0,0 +1,1662 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativeexpression.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdebug.h> +#include <QtDeclarative/private/qdeclarativeguard_p.h> +#include <QtCore/qdir.h> +#include <QtCore/qnumeric.h> +#include <private/qdeclarativeengine_p.h> +#include <private/qdeclarativeglobalscriptclass_p.h> +#include "testtypes.h" + +/* +This test covers evaluation of ECMAScript expressions and bindings from within +QML. This does not include static QML language issues. + +Static QML language issues are covered in qmllanguage +*/ +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} + +class tst_qdeclarativeecmascript : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeecmascript() {} + +private slots: + void initTestCase(); + void assignBasicTypes(); + void idShortcutInvalidates(); + void boolPropertiesEvaluateAsBool(); + void methods(); + void signalAssignment(); + void bindingLoop(); + void basicExpressions(); + void basicExpressions_data(); + void arrayExpressions(); + void contextPropertiesTriggerReeval(); + void objectPropertiesTriggerReeval(); + void deferredProperties(); + void extensionObjects(); + void attachedProperties(); + void enums(); + void valueTypeFunctions(); + void constantsOverrideBindings(); + void outerBindingOverridesInnerBinding(); + void aliasPropertyAndBinding(); + void nonExistantAttachedObject(); + void scope(); + void signalParameterTypes(); + void objectsCompareAsEqual(); + void scriptAccess(); + void dynamicCreation_data(); + void dynamicCreation(); + void dynamicDestruction(); + void objectToString(); + void selfDeletingBinding(); + void extendedObjectPropertyLookup(); + void scriptErrors(); + void signalTriggeredBindings(); + void listProperties(); + void exceptionClearsOnReeval(); + void exceptionSlotProducesWarning(); + void exceptionBindingProducesWarning(); + void transientErrors(); + void shutdownErrors(); + void externalScript(); + void compositePropertyType(); + void jsObject(); + void undefinedResetsProperty(); + void listToVariant(); + void multiEngineObject(); + void deletedObject(); + + void bug1(); + + void callQtInvokables(); +private: + QDeclarativeEngine engine; +}; + +void tst_qdeclarativeecmascript::initTestCase() { registerTypes(); } + +void tst_qdeclarativeecmascript::assignBasicTypes() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("assignBasicTypes.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); + QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); + QCOMPARE(object->stringProperty(), QString("Hello World!")); + QCOMPARE(object->uintProperty(), uint(10)); + QCOMPARE(object->intProperty(), -19); + QCOMPARE((float)object->realProperty(), float(23.2)); + QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->floatProperty(), float(8.5)); + QCOMPARE(object->colorProperty(), QColor("red")); + QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); + QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); + QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); + QCOMPARE(object->pointProperty(), QPoint(99,13)); + QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3)); + QCOMPARE(object->sizeProperty(), QSize(99, 13)); + QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2)); + QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); + QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); + QCOMPARE(object->boolProperty(), true); + QCOMPARE(object->variantProperty(), QVariant("Hello World!")); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("assignBasicTypes.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); + QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); + QCOMPARE(object->stringProperty(), QString("Hello World!")); + QCOMPARE(object->uintProperty(), uint(10)); + QCOMPARE(object->intProperty(), -19); + QCOMPARE((float)object->realProperty(), float(23.2)); + QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->floatProperty(), float(8.5)); + QCOMPARE(object->colorProperty(), QColor("red")); + QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); + QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); + QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); + QCOMPARE(object->pointProperty(), QPoint(99,13)); + QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3)); + QCOMPARE(object->sizeProperty(), QSize(99, 13)); + QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2)); + QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); + QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); + QCOMPARE(object->boolProperty(), true); + QCOMPARE(object->variantProperty(), QVariant("Hello World!")); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); + delete object; + } +} + +void tst_qdeclarativeecmascript::idShortcutInvalidates() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("idShortcutInvalidates.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->objectProperty() != 0); + delete object->objectProperty(); + QVERIFY(object->objectProperty() == 0); + } +} + +void tst_qdeclarativeecmascript::boolPropertiesEvaluateAsBool() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->stringProperty(), QLatin1String("pass")); + } + { + QDeclarativeComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->stringProperty(), QLatin1String("pass")); + } +} + +void tst_qdeclarativeecmascript::signalAssignment() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("signalAssignment.1.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->string(), QString()); + emit object->basicSignal(); + QCOMPARE(object->string(), QString("pass")); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("signalAssignment.2.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->string(), QString()); + emit object->argumentSignal(19, "Hello world!", 10.3); + QCOMPARE(object->string(), QString("pass 19 Hello world! 10.3")); + } +} + +void tst_qdeclarativeecmascript::methods() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("methods.1.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->methodCalled(), false); + QCOMPARE(object->methodIntCalled(), false); + emit object->basicSignal(); + QCOMPARE(object->methodCalled(), true); + QCOMPARE(object->methodIntCalled(), false); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("methods.2.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->methodCalled(), false); + QCOMPARE(object->methodIntCalled(), false); + emit object->basicSignal(); + QCOMPARE(object->methodCalled(), false); + QCOMPARE(object->methodIntCalled(), true); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("methods.3.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toInt(), 19); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("methods.4.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toInt(), 19); + QCOMPARE(object->property("test2").toInt(), 17); + QCOMPARE(object->property("test3").toInt(), 16); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("methods.5.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("test").toInt(), 9); + } +} + +void tst_qdeclarativeecmascript::bindingLoop() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bindingLoop.qml")); + QString warning = "QML MyQmlObject (" + component.url().toString() + ":9:9) Binding loop detected for property \"stringProperty\""; + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qdeclarativeecmascript::basicExpressions_data() +{ + QTest::addColumn<QString>("expression"); + QTest::addColumn<QVariant>("result"); + QTest::addColumn<bool>("nest"); + + QTest::newRow("Syntax error (self test)") << "{console.log({'a':1'}.a)}" << QVariant() << false; + QTest::newRow("Context property") << "a" << QVariant(1944) << false; + QTest::newRow("Context property") << "a" << QVariant(1944) << true; + QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false; + QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << true; + QTest::newRow("Overridden context property") << "b" << QVariant("Milk") << false; + QTest::newRow("Overridden context property") << "b" << QVariant("Cow") << true; + QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << false; + QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << true; + QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object2") << false; + QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object3") << true; + QTest::newRow("Default object property") << "horseLegs" << QVariant(4) << false; + QTest::newRow("Default object property") << "antLegs" << QVariant(6) << false; + QTest::newRow("Default object property") << "emuLegs" << QVariant(2) << false; + QTest::newRow("Nested default object property") << "horseLegs" << QVariant(4) << true; + QTest::newRow("Nested default object property") << "antLegs" << QVariant(7) << true; + QTest::newRow("Nested default object property") << "emuLegs" << QVariant(2) << true; + QTest::newRow("Nested default object property") << "humanLegs" << QVariant(2) << true; + QTest::newRow("Context property override default object property") << "millipedeLegs" << QVariant(100) << true; +} + +void tst_qdeclarativeecmascript::basicExpressions() +{ + QFETCH(QString, expression); + QFETCH(QVariant, result); + QFETCH(bool, nest); + + MyQmlObject object1; + MyQmlObject object2; + MyQmlObject object3; + MyDefaultObject1 default1; + MyDefaultObject2 default2; + MyDefaultObject3 default3; + object1.setStringProperty("Object1"); + object2.setStringProperty("Object2"); + object3.setStringProperty("Object3"); + + QDeclarativeContext context(engine.rootContext()); + QDeclarativeContext nestedContext(&context); + + context.addDefaultObject(&default1); + context.addDefaultObject(&default2); + context.setContextProperty("a", QVariant(1944)); + context.setContextProperty("b", QVariant("Milk")); + context.setContextProperty("object", &object1); + context.setContextProperty("objectOverride", &object2); + nestedContext.addDefaultObject(&default3); + nestedContext.setContextProperty("b", QVariant("Cow")); + nestedContext.setContextProperty("objectOverride", &object3); + nestedContext.setContextProperty("millipedeLegs", QVariant(100)); + + MyExpression expr(nest?&nestedContext:&context, expression); + QCOMPARE(expr.value(), result); +} + +void tst_qdeclarativeecmascript::arrayExpressions() +{ + QObject obj1; + QObject obj2; + QObject obj3; + + QDeclarativeContext context(engine.rootContext()); + context.setContextProperty("a", &obj1); + context.setContextProperty("b", &obj2); + context.setContextProperty("c", &obj3); + + MyExpression expr(&context, "[a, b, c, 10]"); + QVariant result = expr.value(); + QCOMPARE(result.userType(), qMetaTypeId<QList<QObject *> >()); + QList<QObject *> list = qvariant_cast<QList<QObject *> >(result); + QCOMPARE(list.count(), 4); + QCOMPARE(list.at(0), &obj1); + QCOMPARE(list.at(1), &obj2); + QCOMPARE(list.at(2), &obj3); + QCOMPARE(list.at(3), (QObject *)0); +} + +// Tests that modifying a context property will reevaluate expressions +void tst_qdeclarativeecmascript::contextPropertiesTriggerReeval() +{ + QDeclarativeContext context(engine.rootContext()); + MyQmlObject object1; + MyQmlObject object2; + MyQmlObject *object3 = new MyQmlObject; + + object1.setStringProperty("Hello"); + object2.setStringProperty("World"); + + context.setContextProperty("testProp", QVariant(1)); + context.setContextProperty("testObj", &object1); + context.setContextProperty("testObj2", object3); + + { + MyExpression expr(&context, "testProp + 1"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant(2)); + + context.setContextProperty("testProp", QVariant(2)); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant(3)); + } + + { + MyExpression expr(&context, "testProp + testProp + testProp"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant(6)); + + context.setContextProperty("testProp", QVariant(4)); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant(12)); + } + + { + MyExpression expr(&context, "testObj.stringProperty"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant("Hello")); + + context.setContextProperty("testObj", &object2); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant("World")); + } + + { + MyExpression expr(&context, "testObj.stringProperty /**/"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant("World")); + + context.setContextProperty("testObj", &object1); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant("Hello")); + } + + { + MyExpression expr(&context, "testObj2"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant::fromValue((QObject *)object3)); + } + +} + +void tst_qdeclarativeecmascript::objectPropertiesTriggerReeval() +{ + QDeclarativeContext context(engine.rootContext()); + MyQmlObject object1; + MyQmlObject object2; + MyQmlObject object3; + context.setContextProperty("testObj", &object1); + + object1.setStringProperty(QLatin1String("Hello")); + object2.setStringProperty(QLatin1String("Dog")); + object3.setStringProperty(QLatin1String("Cat")); + + { + MyExpression expr(&context, "testObj.stringProperty"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant("Hello")); + + object1.setStringProperty(QLatin1String("World")); + QCOMPARE(expr.changed, true); + QCOMPARE(expr.value(), QVariant("World")); + } + + { + MyExpression expr(&context, "testObj.objectProperty.stringProperty"); + QCOMPARE(expr.changed, false); + QCOMPARE(expr.value(), QVariant()); + + object1.setObjectProperty(&object2); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Dog")); + + object1.setObjectProperty(&object3); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Cat")); + + object1.setObjectProperty(0); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant()); + + object1.setObjectProperty(&object3); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Cat")); + + object3.setStringProperty("Donkey"); + QCOMPARE(expr.changed, true); + expr.changed = false; + QCOMPARE(expr.value(), QVariant("Donkey")); + } +} + +void tst_qdeclarativeecmascript::deferredProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deferredProperties.qml")); + MyDeferredObject *object = + qobject_cast<MyDeferredObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->value(), 0); + QVERIFY(object->objectProperty() == 0); + QVERIFY(object->objectProperty2() != 0); + qmlExecuteDeferred(object); + QCOMPARE(object->value(), 10); + QVERIFY(object->objectProperty() != 0); + MyQmlObject *qmlObject = + qobject_cast<MyQmlObject *>(object->objectProperty()); + QVERIFY(qmlObject != 0); + QCOMPARE(qmlObject->value(), 10); + object->setValue(19); + QCOMPARE(qmlObject->value(), 19); +} + +void tst_qdeclarativeecmascript::extensionObjects() +{ + QDeclarativeComponent component(&engine, TEST_FILE("extensionObjects.qml")); + MyExtendedObject *object = + qobject_cast<MyExtendedObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->baseProperty(), 13); + QCOMPARE(object->coreProperty(), 9); + + object->setProperty("extendedProperty", QVariant(11)); + object->setProperty("baseExtendedProperty", QVariant(92)); + QCOMPARE(object->coreProperty(), 11); + QCOMPARE(object->baseProperty(), 92); +} + +void tst_qdeclarativeecmascript::attachedProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("attachedProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("a").toInt(), 19); + QCOMPARE(object->property("b").toInt(), 19); + QCOMPARE(object->property("c").toInt(), 19); + QCOMPARE(object->property("d").toInt(), 19); + + // ### Need to test attached property assignment +} + +void tst_qdeclarativeecmascript::enums() +{ + // Existant enums + { + QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("a").toInt(), 0); + QCOMPARE(object->property("b").toInt(), 1); + QCOMPARE(object->property("c").toInt(), 2); + QCOMPARE(object->property("d").toInt(), 3); + QCOMPARE(object->property("e").toInt(), 0); + QCOMPARE(object->property("f").toInt(), 1); + QCOMPARE(object->property("g").toInt(), 2); + QCOMPARE(object->property("h").toInt(), 3); + QCOMPARE(object->property("i").toInt(), 19); + QCOMPARE(object->property("j").toInt(), 19); + } + // Non-existent enums + { + QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml")); + + QString warning1 = component.url().toString() + ":5: Unable to assign [undefined] to int"; + QString warning2 = component.url().toString() + ":6: Unable to assign [undefined] to int"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); + + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("a").toInt(), 0); + QCOMPARE(object->property("b").toInt(), 0); + } +} + +void tst_qdeclarativeecmascript::valueTypeFunctions() +{ + QDeclarativeComponent component(&engine, TEST_FILE("valueTypeFunctions.qml")); + MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); + QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); +} + +/* +Tests that writing a constant to a property with a binding on it disables the +binding. +*/ +void tst_qdeclarativeecmascript::constantsOverrideBindings() +{ + // From ECMAScript + { + QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.1.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("c2").toInt(), 0); + object->setProperty("c1", QVariant(9)); + QCOMPARE(object->property("c2").toInt(), 9); + + emit object->basicSignal(); + + QCOMPARE(object->property("c2").toInt(), 13); + object->setProperty("c1", QVariant(8)); + QCOMPARE(object->property("c2").toInt(), 13); + } + + // During construction + { + QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.2.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("c1").toInt(), 0); + QCOMPARE(object->property("c2").toInt(), 10); + object->setProperty("c1", QVariant(9)); + QCOMPARE(object->property("c1").toInt(), 9); + QCOMPARE(object->property("c2").toInt(), 10); + } + +#if 0 + // From C++ + { + QDeclarativeComponent component(&engine, TEST_FILE("constantsOverrideBindings.3.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("c2").toInt(), 0); + object->setProperty("c1", QVariant(9)); + QCOMPARE(object->property("c2").toInt(), 9); + + object->setProperty("c2", QVariant(13)); + QCOMPARE(object->property("c2").toInt(), 13); + object->setProperty("c1", QVariant(7)); + QCOMPARE(object->property("c1").toInt(), 7); + QCOMPARE(object->property("c2").toInt(), 13); + } +#endif +} + +/* +Tests that assigning a binding to a property that already has a binding causes +the original binding to be disabled. +*/ +void tst_qdeclarativeecmascript::outerBindingOverridesInnerBinding() +{ + QDeclarativeComponent component(&engine, + TEST_FILE("outerBindingOverridesInnerBinding.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("c1").toInt(), 0); + QCOMPARE(object->property("c2").toInt(), 0); + QCOMPARE(object->property("c3").toInt(), 0); + + object->setProperty("c1", QVariant(9)); + QCOMPARE(object->property("c1").toInt(), 9); + QCOMPARE(object->property("c2").toInt(), 0); + QCOMPARE(object->property("c3").toInt(), 0); + + object->setProperty("c3", QVariant(8)); + QCOMPARE(object->property("c1").toInt(), 9); + QCOMPARE(object->property("c2").toInt(), 8); + QCOMPARE(object->property("c3").toInt(), 8); +} + +/* +Access a non-existent attached object. + +Tests for a regression where this used to crash. +*/ +void tst_qdeclarativeecmascript::nonExistantAttachedObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nonExistantAttachedObject.qml")); + + QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qdeclarativeecmascript::scope() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("scope.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), 1); + QCOMPARE(object->property("test2").toInt(), 2); + QCOMPARE(object->property("test3").toString(), QString("1Test")); + QCOMPARE(object->property("test4").toString(), QString("2Test")); + QCOMPARE(object->property("test5").toInt(), 1); + QCOMPARE(object->property("test6").toInt(), 1); + QCOMPARE(object->property("test7").toInt(), 2); + QCOMPARE(object->property("test8").toInt(), 2); + QCOMPARE(object->property("test9").toInt(), 1); + QCOMPARE(object->property("test10").toInt(), 3); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("scope.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), 19); + QCOMPARE(object->property("test2").toInt(), 19); + QCOMPARE(object->property("test3").toInt(), 11); + QCOMPARE(object->property("test4").toInt(), 11); + QCOMPARE(object->property("test5").toInt(), 24); + QCOMPARE(object->property("test6").toInt(), 24); + } +} + +/* +Tests that "any" type passes through a synthesized signal parameter. This +is essentially a test of QDeclarativeMetaType::copy() +*/ +void tst_qdeclarativeecmascript::signalParameterTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("signalParameterTypes.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + emit object->basicSignal(); + + QCOMPARE(object->property("intProperty").toInt(), 10); + QCOMPARE(object->property("realProperty").toReal(), 19.2); + QVERIFY(object->property("colorProperty").value<QColor>() == QColor(255, 255, 0, 255)); + QVERIFY(object->property("variantProperty") == QVariant::fromValue(QColor(255, 0, 255, 255))); +} + +/* +Test that two JS objects for the same QObject compare as equal. +*/ +void tst_qdeclarativeecmascript::objectsCompareAsEqual() +{ + QDeclarativeComponent component(&engine, TEST_FILE("objectsCompareAsEqual.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); + QCOMPARE(object->property("test4").toBool(), true); + QCOMPARE(object->property("test5").toBool(), true); +} + +/* +Confirm bindings and alias properties can coexist. + +Tests for a regression where the binding would not reevaluate. +*/ +void tst_qdeclarativeecmascript::aliasPropertyAndBinding() +{ + QDeclarativeComponent component(&engine, TEST_FILE("aliasPropertyAndBinding.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("c2").toInt(), 3); + QCOMPARE(object->property("c3").toInt(), 3); + + object->setProperty("c2", QVariant(19)); + + QCOMPARE(object->property("c2").toInt(), 19); + QCOMPARE(object->property("c3").toInt(), 19); +} + +/* +Tests that only methods of Script {} blocks are exposed. +*/ +void tst_qdeclarativeecmascript::scriptAccess() +{ + QDeclarativeComponent component(&engine, TEST_FILE("scriptAccess.qml")); + + QString warning = component.url().toString() + ":16: Unable to assign [undefined] to int"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), 10); + QCOMPARE(object->property("test2").toInt(), 19); + QCOMPARE(object->property("test3").toInt(), 0); +} + +void tst_qdeclarativeecmascript::dynamicCreation_data() +{ + QTest::addColumn<QString>("method"); + QTest::addColumn<QString>("createdName"); + + QTest::newRow("One") << "createOne" << "objectOne"; + QTest::newRow("Two") << "createTwo" << "objectTwo"; + QTest::newRow("Three") << "createThree" << "objectThree"; +} + +/* +Test using createQmlObject to dynamically generate an item +Also using createComponent is tested. +*/ +void tst_qdeclarativeecmascript::dynamicCreation() +{ + QFETCH(QString, method); + QFETCH(QString, createdName); + + QDeclarativeComponent component(&engine, TEST_FILE("dynamicCreation.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + + QMetaObject::invokeMethod(object, method.toUtf8()); + QObject *created = object->objectProperty(); + QVERIFY(created); + QCOMPARE(created->objectName(), createdName); +} + +/* + Tests the destroy function +*/ +void tst_qdeclarativeecmascript::dynamicDestruction() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dynamicDeletion.qml")); + QDeclarativeGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QDeclarativeGuard<QObject> createdQmlObject = 0; + + QMetaObject::invokeMethod(object, "create"); + createdQmlObject = object->objectProperty(); + QVERIFY(createdQmlObject); + QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); + + QMetaObject::invokeMethod(object, "killOther"); + QVERIFY(createdQmlObject); + QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QVERIFY(createdQmlObject); + for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up + if (createdQmlObject) { + QTest::qWait(100); + QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + } + } + QVERIFY(!createdQmlObject); + + QMetaObject::invokeMethod(object, "killMe"); + QVERIFY(object); + QTest::qWait(0); + QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); + QVERIFY(!object); +} + +/* + tests that id.toString() works +*/ +void tst_qdeclarativeecmascript::objectToString() +{ + QDeclarativeComponent component(&engine, TEST_FILE("declarativeToString.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QMetaObject::invokeMethod(object, "testToString"); + QVERIFY(object->stringProperty().startsWith("MyQmlObject_QML_")); + QVERIFY(object->stringProperty().endsWith(", \"objName\")")); +} + +/* +Tests bindings that indirectly cause their own deletion work. + +This test is best run under valgrind to ensure no invalid memory access occur. +*/ +void tst_qdeclarativeecmascript::selfDeletingBinding() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("selfDeletingBinding.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + object->setProperty("triggerDelete", true); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("selfDeletingBinding.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + object->setProperty("triggerDelete", true); + } +} + +/* +Test that extended object properties can be accessed. + +This test a regression where this used to crash. The issue was specificially +for extended objects that did not include a synthesized meta object (so non-root +and no synthesiszed properties). +*/ +void tst_qdeclarativeecmascript::extendedObjectPropertyLookup() +{ + QDeclarativeComponent component(&engine, TEST_FILE("extendedObjectPropertyLookup.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +/* +Test file/lineNumbers for binding/Script errors. +*/ +void tst_qdeclarativeecmascript::scriptErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("scriptErrors.qml")); + QString url = component.url().toString(); + + QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\""; + QString warning2 = url + ":7: TypeError: Result of expression 'a' [undefined] is not an object."; + QString warning3 = url + ":5: Error: Invalid write to global property \"a\""; + QString warning4 = url + ":12: TypeError: Result of expression 'a' [undefined] is not an object."; + QString warning5 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object."; + QString warning6 = url + ":9: Unable to assign [undefined] to int"; + QString warning7 = url + ":14: Error: Cannot assign to read-only property \"trueProperty\""; + QString warning8 = url + ":15: Error: Cannot assign to non-existent property \"fakeProperty\""; + + QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); + QTest::ignoreMessage(QtWarningMsg, warning6.toLatin1().constData()); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + + QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); + emit object->basicSignal(); + + QTest::ignoreMessage(QtWarningMsg, warning7.toLatin1().constData()); + emit object->anotherBasicSignal(); + + QTest::ignoreMessage(QtWarningMsg, warning8.toLatin1().constData()); + emit object->thirdBasicSignal(); +} + +/* +Test bindings still work when the reeval is triggered from within +a signal script. +*/ +void tst_qdeclarativeecmascript::signalTriggeredBindings() +{ + QDeclarativeComponent component(&engine, TEST_FILE("signalTriggeredBindings.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("base").toReal(), 50.); + QCOMPARE(object->property("test1").toReal(), 50.); + QCOMPARE(object->property("test2").toReal(), 50.); + + object->basicSignal(); + + QCOMPARE(object->property("base").toReal(), 200.); + QCOMPARE(object->property("test1").toReal(), 200.); + QCOMPARE(object->property("test2").toReal(), 200.); + + object->argumentSignal(10, QString(), 10); + + QCOMPARE(object->property("base").toReal(), 400.); + QCOMPARE(object->property("test1").toReal(), 400.); + QCOMPARE(object->property("test2").toReal(), 400.); +} + +/* +Test that list properties can be iterated from ECMAScript +*/ +void tst_qdeclarativeecmascript::listProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("listProperties.qml")); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), 21); + QCOMPARE(object->property("test2").toInt(), 2); + QCOMPARE(object->property("test3").toBool(), true); + QCOMPARE(object->property("test4").toBool(), true); +} + +void tst_qdeclarativeecmascript::exceptionClearsOnReeval() +{ + QDeclarativeComponent component(&engine, TEST_FILE("exceptionClearsOnReeval.qml")); + QString url = component.url().toString(); + + QString warning = url + ":4: TypeError: Result of expression 'objectProperty.objectProperty' [undefined] is not an object."; + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), false); + + MyQmlObject object2; + MyQmlObject object3; + object2.setObjectProperty(&object3); + object->setObjectProperty(&object2); + + QCOMPARE(object->property("test").toBool(), true); +} + +void tst_qdeclarativeecmascript::exceptionSlotProducesWarning() +{ + QDeclarativeComponent component(&engine, TEST_FILE("exceptionProducesWarning.qml")); + QString url = component.url().toString(); + + QString warning = component.url().toString() + ":6: Error: JS exception"; + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); +} + +void tst_qdeclarativeecmascript::exceptionBindingProducesWarning() +{ + QDeclarativeComponent component(&engine, TEST_FILE("exceptionProducesWarning2.qml")); + QString url = component.url().toString(); + + QString warning = component.url().toString() + ":5: Error: JS exception"; + + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); +} + +static int transientErrorsMsgCount = 0; +static void transientErrorsMsgHandler(QtMsgType, const char *) +{ + ++transientErrorsMsgCount; +} + +// Check that transient binding errors are not displayed +void tst_qdeclarativeecmascript::transientErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("transientErrors.qml")); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + QObject *object = component.create(); + QVERIFY(object != 0); + + qInstallMsgHandler(old); + + QCOMPARE(transientErrorsMsgCount, 0); +} + +// Check that errors during shutdown are minimized +void tst_qdeclarativeecmascript::shutdownErrors() +{ + QDeclarativeComponent component(&engine, TEST_FILE("shutdownErrors.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + transientErrorsMsgCount = 0; + QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); + + delete object; + + qInstallMsgHandler(old); + QCOMPARE(transientErrorsMsgCount, 0); +} + +// Check that Script::source property works as expected +void tst_qdeclarativeecmascript::externalScript() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("externalScript.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("externalScript.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("externalScript.3.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + QCOMPARE(object->property("test2").toInt(), 92); + QCOMPARE(object->property("test3").toBool(), false); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("externalScript.4.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + QCOMPARE(object->property("test2").toBool(), true); + + delete object; + } +} + +void tst_qdeclarativeecmascript::compositePropertyType() +{ + QDeclarativeComponent component(&engine, TEST_FILE("compositePropertyType.qml")); + QTest::ignoreMessage(QtDebugMsg, "hello world"); + QObject *object = qobject_cast<QObject *>(component.create()); + delete object; +} + +// QTBUG-5759 +void tst_qdeclarativeecmascript::jsObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("jsObject.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 92); + + delete object; +} + +void tst_qdeclarativeecmascript::undefinedResetsProperty() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("undefinedResetsProperty.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("resettableProperty").toInt(), 92); + + object->setProperty("setUndefined", true); + + QCOMPARE(object->property("resettableProperty").toInt(), 13); + + object->setProperty("setUndefined", false); + + QCOMPARE(object->property("resettableProperty").toInt(), 92); + + delete object; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("undefinedResetsProperty.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("resettableProperty").toInt(), 19); + + QMetaObject::invokeMethod(object, "doReset"); + + QCOMPARE(object->property("resettableProperty").toInt(), 13); + + delete object; + } +} + +// QTBUG-6781 +void tst_qdeclarativeecmascript::bug1() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bug.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 14); + + object->setProperty("a", 11); + + QCOMPARE(object->property("test").toInt(), 3); + + object->setProperty("b", true); + + QCOMPARE(object->property("test").toInt(), 9); + + delete object; +} + +void tst_qdeclarativeecmascript::callQtInvokables() +{ + MyInvokableObject o; + + QDeclarativeEngine qmlengine; + QDeclarativeEnginePrivate *ep = QDeclarativeEnginePrivate::get(&qmlengine); + QScriptEngine *engine = &ep->scriptEngine; + ep->globalClass->explicitSetProperty("object", ep->objectClass->newQObject(&o)); + + // Non-existent methods + o.reset(); + QCOMPARE(engine->evaluate("object.method_nonexistent()").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_nonexistent(10, 11)").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + // Insufficient arguments + o.reset(); + QCOMPARE(engine->evaluate("object.method_int()").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intint(10)").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + // Excessive arguments + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(10, 11)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(10)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intint(10, 11, 12)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 9); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(10)); + QCOMPARE(o.actuals().at(1), QVariant(11)); + + // Test return types + o.reset(); + QCOMPARE(engine->evaluate("object.method_NoArgs()").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 0); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QVERIFY(engine->evaluate("object.method_NoArgs_int()").strictlyEquals(QScriptValue(engine, 6))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 1); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.7))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 2); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + { + QScriptValue ret = engine->evaluate("object.method_NoArgs_QPointF()"); + QVERIFY(ret.isVariant()); + QCOMPARE(ret.toVariant(), QVariant(QPointF(123, 4.5))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 3); + QCOMPARE(o.actuals().count(), 0); + } + + o.reset(); + { + QScriptValue ret = engine->evaluate("object.method_NoArgs_QObject()"); + QVERIFY(ret.isQObject()); + QCOMPARE(ret.toQObject(), (QObject *)&o); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 4); + QCOMPARE(o.actuals().count(), 0); + } + + o.reset(); + QCOMPARE(engine->evaluate("object.method_NoArgs_unknown()").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 5); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + { + QScriptValue ret = engine->evaluate("object.method_NoArgs_QScriptValue()"); + QVERIFY(ret.isString()); + QCOMPARE(ret.toString(), QString("Hello world")); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 6); + QCOMPARE(o.actuals().count(), 0); + } + + o.reset(); + QVERIFY(engine->evaluate("object.method_NoArgs_QVariant()").strictlyEquals(QScriptValue(engine, "QML rocks"))); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 7); + QCOMPARE(o.actuals().count(), 0); + + // Test arg types + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(94)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(94)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(\"94\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(94)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(\"not a number\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_int(object)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 8); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intint(122, 9)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 9); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(122)); + QCOMPARE(o.actuals().at(1), QVariant(9)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(94.3)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(94.3)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(\"94.3\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(94.3)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(\"not a number\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_real(object)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 10); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QString(\"Hello world\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 11); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant("Hello world")); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QString(19)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 11); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant("19")); + + o.reset(); + { + QString expected = "MyInvokableObject(0x" + QString::number((intptr_t)&o, 16) + ")"; + QCOMPARE(engine->evaluate("object.method_QString(object)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 11); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(expected)); + } + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QString(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 11); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QString())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QString(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 11); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QString())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(0)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(object)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF())); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPointF())").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF(99.3, -10.2))); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPoint())").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 12); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), QVariant(QPointF(9, 12))); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QObject(0)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 13); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QObject(\"Hello world\")").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 13); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QObject(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 13); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QObject(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 13); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QObject(object)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 13); + QCOMPARE(o.actuals().count(), 1); + QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)&o)); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QScriptValue(null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 14); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isNull()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QScriptValue(undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 14); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isUndefined()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QScriptValue(19)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 14); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).strictlyEquals(QScriptValue(engine, 19))); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_QScriptValue([19, 20])").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 14); + QCOMPARE(o.actuals().count(), 1); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isArray()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intQScriptValue(4, null)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 15); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(4)); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isNull()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intQScriptValue(8, undefined)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 15); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(8)); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isUndefined()); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intQScriptValue(3, 19)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 15); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(3)); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).strictlyEquals(QScriptValue(engine, 19))); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_intQScriptValue(44, [19, 20])").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 15); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(44)); + QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isArray()); + + // Test overloads - QML will always invoke the *last* method + o.reset(); + QCOMPARE(engine->evaluate("object.method_overload()").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_overload(10)").isError(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), -1); + QCOMPARE(o.actuals().count(), 0); + + o.reset(); + QCOMPARE(engine->evaluate("object.method_overload(10, 11)").isUndefined(), true); + QCOMPARE(o.error(), false); + QCOMPARE(o.invoked(), 17); + QCOMPARE(o.actuals().count(), 2); + QCOMPARE(o.actuals().at(0), QVariant(10)); + QCOMPARE(o.actuals().at(1), QVariant(11)); +} + +// QTBUG-5675 +void tst_qdeclarativeecmascript::listToVariant() +{ + QDeclarativeComponent component(&engine, TEST_FILE("listToVariant.qml")); + + MyQmlContainer container; + + QDeclarativeContext context(engine.rootContext()); + context.addDefaultObject(&container); + + QObject *object = component.create(&context); + QVERIFY(object != 0); + + QVariant v = object->property("test"); + QCOMPARE(v.userType(), qMetaTypeId<QDeclarativeListReference>()); + QVERIFY(qvariant_cast<QDeclarativeListReference>(v).object() == &container); + + delete object; +} + +// QTBUG-7957 +void tst_qdeclarativeecmascript::multiEngineObject() +{ + MyQmlObject obj; + obj.setStringProperty("Howdy planet"); + + QDeclarativeEngine e1; + e1.rootContext()->setContextProperty("thing", &obj); + QDeclarativeComponent c1(&e1, TEST_FILE("multiEngineObject.qml")); + + QDeclarativeEngine e2; + e2.rootContext()->setContextProperty("thing", &obj); + QDeclarativeComponent c2(&e2, TEST_FILE("multiEngineObject.qml")); + + QObject *o1 = c1.create(); + QObject *o2 = c2.create(); + + QCOMPARE(o1->property("test").toString(), QString("Howdy planet")); + QCOMPARE(o2->property("test").toString(), QString("Howdy planet")); + + delete o2; + delete o1; +} + +// Test that references to QObjects are cleanup when the object is destroyed +void tst_qdeclarativeecmascript::deletedObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deletedObject.qml")); + + QObject *object = component.create(); + + QCOMPARE(object->property("test1").toBool(), true); + QCOMPARE(object->property("test2").toBool(), true); + QCOMPARE(object->property("test3").toBool(), true); + QEXPECT_FAIL("", "QTBUG-8077", Continue); + QCOMPARE(object->property("test4").toBool(), true); + + delete object; +} + +QTEST_MAIN(tst_qdeclarativeecmascript) + +#include "tst_qdeclarativeecmascript.moc" diff --git a/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro new file mode 100644 index 0000000..5b6530d --- /dev/null +++ b/tests/auto/declarative/qdeclarativeengine/qdeclarativeengine.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeengine.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp new file mode 100644 index 0000000..5dc5f19 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeengine/tst_qdeclarativeengine.cpp @@ -0,0 +1,240 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeContext> +#include <QNetworkAccessManager> +#include <QPointer> +#include <QDir> +#include <QDesktopServices> +#include <QDebug> +#include <QDeclarativeComponent> +#include <QDeclarativeNetworkAccessManagerFactory> + +class tst_qdeclarativeengine : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeengine() {} + +private slots: + void rootContext(); + void networkAccessManager(); + void baseUrl(); + void contextForObject(); + void offlineStoragePath(); + void clearComponentCache(); +}; + +void tst_qdeclarativeengine::rootContext() +{ + QDeclarativeEngine engine; + + QVERIFY(engine.rootContext()); + + QCOMPARE(engine.rootContext()->engine(), &engine); + QVERIFY(engine.rootContext()->parentContext() == 0); +} + +class NetworkAccessManagerFactory : public QDeclarativeNetworkAccessManagerFactory +{ +public: + NetworkAccessManagerFactory() : manager(0) {} + + QNetworkAccessManager *create(QObject *parent) { + manager = new QNetworkAccessManager(parent); + return manager; + } + + QNetworkAccessManager *manager; +}; + +void tst_qdeclarativeengine::networkAccessManager() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + + // Test QDeclarativeEngine created manager + QPointer<QNetworkAccessManager> manager = engine->networkAccessManager(); + QVERIFY(manager != 0); + delete engine; + + // Test factory created manager + engine = new QDeclarativeEngine; + NetworkAccessManagerFactory factory; + engine->setNetworkAccessManagerFactory(&factory); + QVERIFY(engine->networkAccessManager() == factory.manager); + delete engine; +} + +void tst_qdeclarativeengine::baseUrl() +{ + QDeclarativeEngine engine; + + QUrl cwd = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()); + + QCOMPARE(engine.baseUrl(), cwd); + QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml"))); + + QDir dir = QDir::current(); + dir.cdUp(); + QVERIFY(dir != QDir::current()); + QDir::setCurrent(dir.path()); + QVERIFY(QDir::current() == dir); + + QUrl cwd2 = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()); + QCOMPARE(engine.baseUrl(), cwd2); + QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd2.resolved(QUrl("main.qml"))); + + engine.setBaseUrl(cwd); + QCOMPARE(engine.baseUrl(), cwd); + QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml"))); +} + +void tst_qdeclarativeengine::contextForObject() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + + // Test null-object + QVERIFY(QDeclarativeEngine::contextForObject(0) == 0); + + // Test an object with no context + QObject object; + QVERIFY(QDeclarativeEngine::contextForObject(&object) == 0); + + // Test setting null-object + QDeclarativeEngine::setContextForObject(0, engine->rootContext()); + + // Test setting null-context + QDeclarativeEngine::setContextForObject(&object, 0); + + // Test setting context + QDeclarativeEngine::setContextForObject(&object, engine->rootContext()); + QVERIFY(QDeclarativeEngine::contextForObject(&object) == engine->rootContext()); + + QDeclarativeContext context(engine->rootContext()); + + // Try changing context + QTest::ignoreMessage(QtWarningMsg, "QDeclarativeEngine::setContextForObject(): Object already has a QDeclarativeContext"); + QDeclarativeEngine::setContextForObject(&object, &context); + QVERIFY(QDeclarativeEngine::contextForObject(&object) == engine->rootContext()); + + // Delete context + delete engine; engine = 0; + QVERIFY(QDeclarativeEngine::contextForObject(&object) == 0); +} + +void tst_qdeclarativeengine::offlineStoragePath() +{ + // Without these set, QDesktopServices::storageLocation returns + // strings with extra "//" at the end. We set them to ignore this problem. + qApp->setApplicationName("tst_qdeclarativeengine"); + qApp->setOrganizationName("Nokia"); + qApp->setOrganizationDomain("nokia.com"); + + QDeclarativeEngine engine; + + QDir dir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); + dir.mkpath("QML"); + dir.cd("QML"); + dir.mkpath("OfflineStorage"); + dir.cd("OfflineStorage"); + + QCOMPARE(QDir::fromNativeSeparators(engine.offlineStoragePath()), dir.path()); + + engine.setOfflineStoragePath(QDir::homePath()); + QCOMPARE(engine.offlineStoragePath(), QDir::homePath()); +} + +void tst_qdeclarativeengine::clearComponentCache() +{ + QDeclarativeEngine engine; + + // Create original qml file + { + QFile file("temp.qml"); + QVERIFY(file.open(QIODevice::WriteOnly)); + file.write("import Qt 4.6\nQtObject {\nproperty int test: 10\n}\n"); + file.close(); + } + + // Test "test" property + { + QDeclarativeComponent component(&engine, "temp.qml"); + QObject *obj = component.create(); + QVERIFY(obj != 0); + QCOMPARE(obj->property("test").toInt(), 10); + delete obj; + } + + // Modify qml file + { + QFile file("temp.qml"); + QVERIFY(file.open(QIODevice::WriteOnly)); + file.write("import Qt 4.6\nQtObject {\nproperty int test: 11\n}\n"); + file.close(); + } + + // Test cache hit + { + QDeclarativeComponent component(&engine, "temp.qml"); + QObject *obj = component.create(); + QVERIFY(obj != 0); + QCOMPARE(obj->property("test").toInt(), 10); + delete obj; + } + + // Clear cache + engine.clearComponentCache(); + + // Test cache refresh + { + QDeclarativeComponent component(&engine, "temp.qml"); + QObject *obj = component.create(); + QVERIFY(obj != 0); + QCOMPARE(obj->property("test").toInt(), 11); + delete obj; + } +} + +QTEST_MAIN(tst_qdeclarativeengine) + +#include "tst_qdeclarativeengine.moc" diff --git a/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro new file mode 100644 index 0000000..6591406 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeerror/qdeclarativeerror.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativeerror.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlerror/test.txt b/tests/auto/declarative/qdeclarativeerror/test.txt index cdafd9e..cdafd9e 100644 --- a/tests/auto/declarative/qmlerror/test.txt +++ b/tests/auto/declarative/qdeclarativeerror/test.txt diff --git a/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp new file mode 100644 index 0000000..ba1ebae --- /dev/null +++ b/tests/auto/declarative/qdeclarativeerror/tst_qdeclarativeerror.cpp @@ -0,0 +1,242 @@ +/**************************************************************************** +** +** 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 <QDeclarativeError> +#include <QDebug> + +class tst_qdeclarativeerror : public QObject +{ + Q_OBJECT +private slots: + void url(); + void description(); + void line(); + void column(); + void toString(); + + void copy(); + void debug(); +}; + +void tst_qdeclarativeerror::url() +{ + QDeclarativeError error; + + QCOMPARE(error.url(), QUrl()); + + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + + QCOMPARE(error.url(), QUrl("http://www.nokia.com/main.qml")); + + QDeclarativeError error2 = error; + + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); + + error.setUrl(QUrl("http://qt.nokia.com/main.qml")); + + QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); +} + +void tst_qdeclarativeerror::description() +{ + QDeclarativeError error; + + QCOMPARE(error.description(), QString()); + + error.setDescription("An Error"); + + QCOMPARE(error.description(), QString("An Error")); + + QDeclarativeError error2 = error; + + QCOMPARE(error2.description(), QString("An Error")); + + error.setDescription("Another Error"); + + QCOMPARE(error.description(), QString("Another Error")); + QCOMPARE(error2.description(), QString("An Error")); +} + +void tst_qdeclarativeerror::line() +{ + QDeclarativeError error; + + QCOMPARE(error.line(), -1); + + error.setLine(102); + + QCOMPARE(error.line(), 102); + + QDeclarativeError error2 = error; + + QCOMPARE(error2.line(), 102); + + error.setLine(4); + + QCOMPARE(error.line(), 4); + QCOMPARE(error2.line(), 102); +} + +void tst_qdeclarativeerror::column() +{ + QDeclarativeError error; + + QCOMPARE(error.column(), -1); + + error.setColumn(16); + + QCOMPARE(error.column(), 16); + + QDeclarativeError error2 = error; + + QCOMPARE(error2.column(), 16); + + error.setColumn(3); + + QCOMPARE(error.column(), 3); + QCOMPARE(error2.column(), 16); +} + +void tst_qdeclarativeerror::toString() +{ + { + QDeclarativeError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92:13: An Error")); + } + + { + QDeclarativeError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + + QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92: An Error")); + } +} + +void tst_qdeclarativeerror::copy() +{ + QDeclarativeError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QDeclarativeError error2(error); + QDeclarativeError error3; + error3 = error; + + error.setUrl(QUrl("http://qt.nokia.com/main.qml")); + error.setDescription("Another Error"); + error.setLine(2); + error.setColumn(33); + + QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); + QCOMPARE(error.description(), QString("Another Error")); + QCOMPARE(error.line(), 2); + QCOMPARE(error.column(), 33); + + QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); + QCOMPARE(error2.description(), QString("An Error")); + QCOMPARE(error2.line(), 92); + QCOMPARE(error2.column(), 13); + + QCOMPARE(error3.url(), QUrl("http://www.nokia.com/main.qml")); + QCOMPARE(error3.description(), QString("An Error")); + QCOMPARE(error3.line(), 92); + QCOMPARE(error3.column(), 13); + +} + +void tst_qdeclarativeerror::debug() +{ + { + QDeclarativeError error; + error.setUrl(QUrl("http://www.nokia.com/main.qml")); + error.setDescription("An Error"); + error.setLine(92); + error.setColumn(13); + + QTest::ignoreMessage(QtWarningMsg, "http://www.nokia.com/main.qml:92:13: An Error "); + qWarning() << error; + } + + { + QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("test.txt"))); + QDeclarativeError error; + error.setUrl(url); + error.setDescription("An Error"); + error.setLine(2); + error.setColumn(5); + + QString out = url.toString() + ":2:5: An Error \n Line2 Content \n ^ "; + QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); + + qWarning() << error; + } + + { + QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("foo.txt"))); + QDeclarativeError error; + error.setUrl(url); + error.setDescription("An Error"); + error.setLine(2); + error.setColumn(5); + + QString out = url.toString() + ":2:5: An Error "; + QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); + + qWarning() << error; + } +} + + + +QTEST_MAIN(tst_qdeclarativeerror) + +#include "tst_qdeclarativeerror.moc" diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml index 8a1843c..8a1843c 100644 --- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable01.qml +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable01.qml diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml new file mode 100644 index 0000000..4b82d5c --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable02.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + contentWidth: row.width; contentHeight: row.height + + Row { + id: row + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: "blue" } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml new file mode 100644 index 0000000..49eed5a --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable03.qml @@ -0,0 +1,14 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + contentWidth: column.width; contentHeight: column.height + + Column { + id: column + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: "blue" } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml new file mode 100644 index 0000000..40c4606 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/data/flickable04.qml @@ -0,0 +1,16 @@ +import Qt 4.6 + +Flickable { + width: 100; height: 100 + contentWidth: column.width; contentHeight: column.height + pressDelay: 200; overShoot: false; interactive: false + maximumFlickVelocity: 2000 + + Column { + id: column + Repeater { + model: 4 + Rectangle { width: 200; height: 300; color: "blue" } + } + } +} diff --git a/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro new file mode 100644 index 0000000..4b71381 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/qdeclarativeflickable.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeflickable.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp new file mode 100644 index 0000000..cb87977 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflickable/tst_qdeclarativeflickable.cpp @@ -0,0 +1,223 @@ +/**************************************************************************** +** +** 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 <QtTest/QSignalSpy> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeflickable_p.h> +#include <private/qdeclarativevaluetype_p.h> +#include <math.h> + +class tst_qdeclarativeflickable : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeflickable(); + +private slots: + void create(); + void horizontalViewportSize(); + void verticalViewportSize(); + void properties(); + void overShoot(); + void maximumFlickVelocity(); + void flickDeceleration(); + void pressDelay(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeflickable::tst_qdeclarativeflickable() +{ +} + +void tst_qdeclarativeflickable::create() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable01.qml")); + QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + QCOMPARE(obj->contentX(), 0.); + QCOMPARE(obj->contentY(), 0.); + + QCOMPARE(obj->horizontalVelocity(), 0.); + QCOMPARE(obj->verticalVelocity(), 0.); + + QCOMPARE(obj->isInteractive(), true); + QCOMPARE(obj->overShoot(), true); + QCOMPARE(obj->pressDelay(), 0); + QCOMPARE(obj->maximumFlickVelocity(), 2000.); + + delete obj; +} + +void tst_qdeclarativeflickable::horizontalViewportSize() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable02.qml")); + QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->contentWidth(), 800.); + QCOMPARE(obj->contentHeight(), 300.); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + + delete obj; +} + +void tst_qdeclarativeflickable::verticalViewportSize() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); + QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->contentWidth(), 200.); + QCOMPARE(obj->contentHeight(), 1200.); + QCOMPARE(obj->isAtXBeginning(), true); + QCOMPARE(obj->isAtXEnd(), false); + QCOMPARE(obj->isAtYBeginning(), true); + QCOMPARE(obj->isAtYEnd(), false); + + delete obj; +} + +void tst_qdeclarativeflickable::properties() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable04.qml")); + QDeclarativeFlickable *obj = qobject_cast<QDeclarativeFlickable*>(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->isInteractive(), false); + QCOMPARE(obj->overShoot(), false); + QCOMPARE(obj->pressDelay(), 200); + QCOMPARE(obj->maximumFlickVelocity(), 2000.); + + delete obj; +} + +void tst_qdeclarativeflickable::overShoot() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(overShootChanged())); + + QVERIFY(flickable); + QVERIFY(!flickable->overShoot()); + + flickable->setOverShoot(true); + QVERIFY(flickable->overShoot()); + QCOMPARE(spy.count(),1); + flickable->setOverShoot(true); + QCOMPARE(spy.count(),1); + + flickable->setOverShoot(false); + QVERIFY(!flickable->overShoot()); + QCOMPARE(spy.count(),2); + flickable->setOverShoot(false); + QCOMPARE(spy.count(),2); +} + +void tst_qdeclarativeflickable::maximumFlickVelocity() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->maximumFlickVelocity(), 1.0); + + flickable->setMaximumFlickVelocity(2.0); + QCOMPARE(flickable->maximumFlickVelocity(), 2.0); + QCOMPARE(spy.count(),1); + flickable->setMaximumFlickVelocity(2.0); + QCOMPARE(spy.count(),1); +} + +void tst_qdeclarativeflickable::flickDeceleration() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->flickDeceleration(), 1.0); + + flickable->setFlickDeceleration(2.0); + QCOMPARE(flickable->flickDeceleration(), 2.0); + QCOMPARE(spy.count(),1); + flickable->setFlickDeceleration(2.0); + QCOMPARE(spy.count(),1); +} + +void tst_qdeclarativeflickable::pressDelay() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); + QDeclarativeFlickable *flickable = qobject_cast<QDeclarativeFlickable*>(component.create()); + QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); + + QVERIFY(flickable); + QCOMPARE(flickable->pressDelay(), 100); + + flickable->setPressDelay(200); + QCOMPARE(flickable->pressDelay(), 200); + QCOMPARE(spy.count(),1); + flickable->setPressDelay(200); + QCOMPARE(spy.count(),1); +} + +QTEST_MAIN(tst_qdeclarativeflickable) + +#include "tst_qdeclarativeflickable.moc" diff --git a/tests/auto/declarative/qmlgraphicsflipable/data/test-flipable.qml b/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml index 21d356d..21d356d 100644 --- a/tests/auto/declarative/qmlgraphicsflipable/data/test-flipable.qml +++ b/tests/auto/declarative/qdeclarativeflipable/data/test-flipable.qml diff --git a/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro new file mode 100644 index 0000000..e29d324 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflipable/qdeclarativeflipable.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeflipable.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp new file mode 100644 index 0000000..ed37c43 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeflipable/tst_qdeclarativeflipable.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeflipable_p.h> +#include <private/qdeclarativevaluetype_p.h> +#include <QFontMetrics> +#include <private/qdeclarativerectangle_p.h> +#include <math.h> + +class tst_qdeclarativeflipable : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeflipable(); + +private slots: + void create(); + void checkFrontAndBack(); + void setFrontAndBack(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeflipable::tst_qdeclarativeflipable() +{ +} + +void tst_qdeclarativeflipable::create() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeFlipable *obj = qobject_cast<QDeclarativeFlipable*>(c.create()); + + QVERIFY(obj != 0); + delete obj; +} + +void tst_qdeclarativeflipable::checkFrontAndBack() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeFlipable *obj = qobject_cast<QDeclarativeFlipable*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->front() != 0); + QVERIFY(obj->back() != 0); + delete obj; +} + +void tst_qdeclarativeflipable::setFrontAndBack() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); + QDeclarativeFlipable *obj = qobject_cast<QDeclarativeFlipable*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->front() != 0); + QVERIFY(obj->back() != 0); + + QString message = "QML Flipable (" + c.url().toString() + ":3:1) front is a write-once property"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + obj->setFront(new QDeclarativeRectangle()); + + message = "QML Flipable (" + c.url().toString() + ":3:1) back is a write-once property"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + obj->setBack(new QDeclarativeRectangle()); + delete obj; +} + +QTEST_MAIN(tst_qdeclarativeflipable) + +#include "tst_qdeclarativeflipable.moc" diff --git a/tests/auto/declarative/qmlfontloader/data/dummy.ttf b/tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf index e69de29..e69de29 100644 --- a/tests/auto/declarative/qmlfontloader/data/dummy.ttf +++ b/tests/auto/declarative/qdeclarativefontloader/data/dummy.ttf diff --git a/tests/auto/declarative/qmlfontloader/data/tarzeau_ocr_a.ttf b/tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf Binary files differindex cf93f96..cf93f96 100644 --- a/tests/auto/declarative/qmlfontloader/data/tarzeau_ocr_a.ttf +++ b/tests/auto/declarative/qdeclarativefontloader/data/tarzeau_ocr_a.ttf diff --git a/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro new file mode 100644 index 0000000..0c736b4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/qdeclarativefontloader.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativefontloader.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp new file mode 100644 index 0000000..a9762df --- /dev/null +++ b/tests/auto/declarative/qdeclarativefontloader/tst_qdeclarativefontloader.cpp @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativefontloader_p.h> +#include "../../../shared/util.h" + +class tst_qdeclarativefontloader : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativefontloader(); + +private slots: + void noFont(); + void namedFont(); + void localFont(); + void failLocalFont(); + void webFont(); + void failWebFont(); + +private slots: + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativefontloader::tst_qdeclarativefontloader() +{ +} + +void tst_qdeclarativefontloader::noFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QCOMPARE(fontObject->name(), QString("")); + QCOMPARE(fontObject->source(), QUrl("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Null); + + delete fontObject; +} + +void tst_qdeclarativefontloader::namedFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QCOMPARE(fontObject->source(), QUrl("")); + QCOMPARE(fontObject->name(), QString("Helvetica")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::localFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("OCRA")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::failLocalFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; + QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Error); +} + +void tst_qdeclarativefontloader::webFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("Starburst")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Ready); +} + +void tst_qdeclarativefontloader::failWebFont() +{ + QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; + QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeFontLoader *fontObject = qobject_cast<QDeclarativeFontLoader*>(component.create()); + + QVERIFY(fontObject != 0); + QVERIFY(fontObject->source() != QUrl("")); + QTRY_COMPARE(fontObject->name(), QString("")); + QTRY_VERIFY(fontObject->status() == QDeclarativeFontLoader::Error); +} + +QTEST_MAIN(tst_qdeclarativefontloader) + +#include "tst_qdeclarativefontloader.moc" diff --git a/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml b/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml new file mode 100644 index 0000000..d3cdcd8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/displaygrid.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + width: 80 + height: 60 + border.color: "blue" + Text { + text: index + } + Text { + y: 20 + id: displayText + objectName: "displayText" + text: display + } + color: GridView.isCurrentItem ? "lightsteelblue" : "white" + } + } + ] + GridView { + id: grid + objectName: "grid" + width: 240 + height: 320 + cellWidth: 80 + cellHeight: 60 + model: testModel + delegate: myDelegate + } +} diff --git a/tests/auto/declarative/qmlgraphicsgridview/data/gridview-initCurrent.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml index 32833d2..32833d2 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/data/gridview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview-initCurrent.qml diff --git a/tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml index 344b4b5..344b4b5 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/data/gridview.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview.qml diff --git a/tests/auto/declarative/qmlgraphicsgridview/data/gridview2.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml index 62b5bd3..62b5bd3 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/data/gridview2.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview2.qml diff --git a/tests/auto/declarative/qmlgraphicsgridview/data/gridview3.qml b/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml index b133d55..b133d55 100644 --- a/tests/auto/declarative/qmlgraphicsgridview/data/gridview3.qml +++ b/tests/auto/declarative/qdeclarativegridview/data/gridview3.qml diff --git a/tests/auto/declarative/qdeclarativegridview/data/setindex.qml b/tests/auto/declarative/qdeclarativegridview/data/setindex.qml new file mode 100644 index 0000000..908b365 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/data/setindex.qml @@ -0,0 +1,33 @@ +import Qt 4.6 + +Rectangle { + width: 200 + height: 200 + Component { + id: appDelegate + + Item { + id : wrapper + Script { + function startupFunction() + { + if (index == 5) view.currentIndex = index; + + } + } + Component.onCompleted: startupFunction(); + width: 30; height: 30 + Text { text: index } + } + } + + GridView { + id: view + objectName: "grid" + anchors.fill: parent + cellWidth: 30; cellHeight: 30 + model: 35 + delegate: appDelegate + focus: true + } +} diff --git a/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro new file mode 100644 index 0000000..af206d7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/qdeclarativegridview.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativegridview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp new file mode 100644 index 0000000..2a60fee --- /dev/null +++ b/tests/auto/declarative/qdeclarativegridview/tst_qdeclarativegridview.cpp @@ -0,0 +1,1022 @@ +/**************************************************************************** +** +** 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 <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> + +class tst_QDeclarativeGridView : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeGridView(); + +private slots: + void items(); + void changed(); + void inserted(); + void removed(); + void moved(); + void changeFlow(); + void currentIndex(); + void defaultValues(); + void properties(); + void positionViewAtIndex(); + void resetModel(); + void QTBUG_8456(); + +private: + QDeclarativeView *createView(); + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); + template<typename T> + QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); + void dumpTree(QDeclarativeItem *parent, int depth = 0); +}; + +class TestModel : public QAbstractListModel +{ +public: + enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; + + TestModel(QObject *parent=0) : QAbstractListModel(parent) { + QHash<int, QByteArray> roles; + roles[Name] = "name"; + roles[Number] = "number"; + setRoleNames(roles); + } + + int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { + QVariant rv; + if (role == Name) + rv = list.at(index.row()).first; + else if (role == Number) + rv = list.at(index.row()).second; + + return rv; + } + + int count() const { return rowCount(); } + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + void addItem(const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()); + list.append(QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void insertItem(int index, const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), index, index); + list.insert(index, QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void removeItem(int index) { + emit beginRemoveRows(QModelIndex(), index, index); + list.removeAt(index); + emit endRemoveRows(); + } + + void moveItem(int from, int to) { + emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + list.move(from, to); + emit endMoveRows(); + } + + void modifyItem(int idx, const QString &name, const QString &number) { + list[idx] = QPair<QString,QString>(name, number); + emit dataChanged(index(idx,0), index(idx,0)); + } + +private: + QList<QPair<QString,QString> > list; +}; + +tst_QDeclarativeGridView::tst_QDeclarativeGridView() +{ +} + +void tst_QDeclarativeGridView::items() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + model.addItem("Billy", "22345"); + model.addItem("Sam", "2945"); + model.addItem("Ben", "04321"); + model.addItem("Jim", "0780"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + QCOMPARE(gridview->count(), model.count()); + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + for (int i = 0; i < model.count(); ++i) { + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + // set an empty model and confirm that items are destroyed + TestModel model2; + ctxt->setContextProperty("testModel", &model2); + + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 0); + + delete canvas; +} + +void tst_QDeclarativeGridView::changed() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + model.addItem("Billy", "22345"); + model.addItem("Sam", "2945"); + model.addItem("Ben", "04321"); + model.addItem("Jim", "0780"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeFlickable *gridview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.modifyItem(1, "Will", "9876"); + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + delete canvas; +} + +void tst_QDeclarativeGridView::inserted() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.insertItem(1, "Will", "9876"); + + // let transitions settle. + QTest::qWait(300); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + QCOMPARE(item->x(), (i%3)*80.0); + QCOMPARE(item->y(), (i/3)*60.0); + } + + model.insertItem(0, "Foo", "1111"); // zero index, and current item + + // let transitions settle. + QTest::qWait(300); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + name = findItem<QDeclarativeText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + QCOMPARE(gridview->currentIndex(), 1); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + for (int i = model.count(); i < 30; ++i) + model.insertItem(i, "Hello", QString::number(i)); + QTest::qWait(300); + + gridview->setContentY(120); + QTest::qWait(300); + + // Insert item outside visible area + model.insertItem(1, "Hello", "1324"); + QTest::qWait(300); + + QVERIFY(gridview->contentY() == 120); + + delete canvas; +} + +void tst_QDeclarativeGridView::removed() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.removeItem(1); + + // let transitions settle. + QTest::qWait(300); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove first item (which is the current item); + model.removeItem(0); + + // let transitions settle. + QTest::qWait(300); + + name = findItem<QDeclarativeText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove items not visible + model.removeItem(25); + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove items before visible + gridview->setContentY(120); + QTest::qWait(500); + gridview->setCurrentIndex(10); + + // let transitions settle. + QTest::qWait(300); + + // Setting currentIndex above shouldn't cause view to scroll + QCOMPARE(gridview->contentY(), 120.0); + + model.removeItem(1); + + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + for (int i = 6; i < 18; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // Remove currentIndex + QDeclarativeItem *oldCurrent = gridview->currentItem(); + model.removeItem(9); + QTest::qWait(500); + + QCOMPARE(gridview->currentIndex(), 9); + QVERIFY(gridview->currentItem() != oldCurrent); + + gridview->setContentY(0); + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + // remove item outside current view. + gridview->setCurrentIndex(32); + QTest::qWait(500); + gridview->setContentY(240); + + model.removeItem(30); + QVERIFY(gridview->currentIndex() == 31); + + // remove current item beyond visible items. + gridview->setCurrentIndex(20); + QTest::qWait(500); + gridview->setContentY(0); + model.removeItem(20); + QTest::qWait(500); + + QCOMPARE(gridview->currentIndex(), 20); + QVERIFY(gridview->currentItem() != 0); + + // remove item before current, but visible + gridview->setCurrentIndex(8); + QTest::qWait(500); + gridview->setContentY(240); + oldCurrent = gridview->currentItem(); + model.removeItem(6); + QTest::qWait(500); + + QCOMPARE(gridview->currentIndex(), 7); + QVERIFY(gridview->currentItem() == oldCurrent); + + delete canvas; +} + +void tst_QDeclarativeGridView::moved() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + model.moveItem(1, 8); + + // let transitions settle. + QTest::qWait(300); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + name = findItem<QDeclarativeText>(viewport, "textName", 8); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(8)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 8); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(8)); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + } + + gridview->setContentY(120); + + // move outside visible area + model.moveItem(1, 25); + + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly and indexes correct + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count()-1; + for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), qreal((i%3)*80)); + QCOMPARE(item->y(), qreal((i/3)*60)); + name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + // move from outside visible into visible + model.moveItem(28, 8); + + // let transitions settle. + QTest::qWait(300); + + // Confirm items positioned correctly and indexes correct + for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->x() == (i%3)*80); + QVERIFY(item->y() == (i/3)*60); + name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + delete canvas; +} + +void tst_QDeclarativeGridView::currentIndex() +{ + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + QString filename(SRCDIR "/data/gridview-initCurrent.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + QTest::qWait(500); + + // current item should be third item + QCOMPARE(gridview->currentIndex(), 5); + QCOMPARE(gridview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 5)); + QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); + + gridview->moveCurrentIndexRight(); + QCOMPARE(gridview->currentIndex(), 6); + gridview->moveCurrentIndexDown(); + QCOMPARE(gridview->currentIndex(), 9); + gridview->moveCurrentIndexUp(); + QCOMPARE(gridview->currentIndex(), 6); + gridview->moveCurrentIndexLeft(); + QCOMPARE(gridview->currentIndex(), 5); + + // no wrap + gridview->setCurrentIndex(0); + QCOMPARE(gridview->currentIndex(), 0); + + gridview->moveCurrentIndexUp(); + QCOMPARE(gridview->currentIndex(), 0); + + gridview->moveCurrentIndexLeft(); + QCOMPARE(gridview->currentIndex(), 0); + + gridview->setCurrentIndex(model.count()-1); + QTest::qWait(500); + QCOMPARE(gridview->currentIndex(), model.count()-1); + + gridview->moveCurrentIndexRight(); + QCOMPARE(gridview->currentIndex(), model.count()-1); + + gridview->moveCurrentIndexDown(); + QCOMPARE(gridview->currentIndex(), model.count()-1); + + // with wrap + gridview->setWrapEnabled(true); + + gridview->setCurrentIndex(0); + QCOMPARE(gridview->currentIndex(), 0); + QTest::qWait(500); + + gridview->moveCurrentIndexLeft(); + QCOMPARE(gridview->currentIndex(), model.count()-1); + + QTest::qWait(500); + QCOMPARE(gridview->contentY(), 279.0); + + gridview->moveCurrentIndexRight(); + QCOMPARE(gridview->currentIndex(), 0); + + QTest::qWait(500); + QCOMPARE(gridview->contentY(), 0.0); + + // Test keys + qApp->setActiveWindow(canvas); + canvas->show(); + canvas->setFocus(); + qApp->processEvents(); + + QTest::keyClick(canvas, Qt::Key_Down); + QCOMPARE(gridview->currentIndex(), 3); + + QTest::keyClick(canvas, Qt::Key_Up); + QCOMPARE(gridview->currentIndex(), 0); + + gridview->setFlow(QDeclarativeGridView::TopToBottom); + + QEXPECT_FAIL("", "QTBUG-8475", Abort); + QTest::keyClick(canvas, Qt::Key_Right); + QCOMPARE(gridview->currentIndex(), 5); + + QTest::keyClick(canvas, Qt::Key_Left); + QCOMPARE(gridview->currentIndex(), 0); + + QTest::keyClick(canvas, Qt::Key_Down); + QCOMPARE(gridview->currentIndex(), 1); + + QTest::keyClick(canvas, Qt::Key_Up); + QCOMPARE(gridview->currentIndex(), 0); + + + // 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(); + + gridview->setCurrentIndex(5); + QTest::qWait(500); + QCOMPARE(gridview->highlightItem()->x(), hlPosX); + QCOMPARE(gridview->highlightItem()->y(), hlPosY); + + delete canvas; +} + +void tst_QDeclarativeGridView::changeFlow() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly and indexes correct + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), qreal((i%3)*80)); + QCOMPARE(item->y(), qreal((i/3)*60)); + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + ctxt->setContextProperty("testTopToBottom", QVariant(true)); + QTest::qWait(500); + + // Confirm items positioned correctly and indexes correct + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), qreal((i/5)*80)); + QCOMPARE(item->y(), qreal((i%5)*60)); + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + delete canvas; +} + +void tst_QDeclarativeGridView::defaultValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); + QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->model() == QVariant()); + QVERIFY(obj->delegate() == 0); + QCOMPARE(obj->currentIndex(), -1); + QVERIFY(obj->currentItem() == 0); + QCOMPARE(obj->count(), 0); + QVERIFY(obj->highlight() == 0); + QVERIFY(obj->highlightItem() == 0); + QCOMPARE(obj->highlightFollowsCurrentItem(), true); + QVERIFY(obj->flow() == 0); + QCOMPARE(obj->isWrapEnabled(), false); + QCOMPARE(obj->cacheBuffer(), 0); + QCOMPARE(obj->cellWidth(), 100); //### Should 100 be the default? + QCOMPARE(obj->cellHeight(), 100); + delete obj; +} + +void tst_QDeclarativeGridView::properties() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); + QDeclarativeGridView *obj = qobject_cast<QDeclarativeGridView*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->model() != QVariant()); + QVERIFY(obj->delegate() != 0); + QCOMPARE(obj->currentIndex(), 0); + QVERIFY(obj->currentItem() != 0); + QCOMPARE(obj->count(), 4); + QVERIFY(obj->highlight() != 0); + QVERIFY(obj->highlightItem() != 0); + QCOMPARE(obj->highlightFollowsCurrentItem(), false); + QVERIFY(obj->flow() == 0); + QCOMPARE(obj->isWrapEnabled(), true); + QCOMPARE(obj->cacheBuffer(), 200); + QCOMPARE(obj->cellWidth(), 100); + QCOMPARE(obj->cellHeight(), 100); + delete obj; +} + +void tst_QDeclarativeGridView::positionViewAtIndex() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testTopToBottom", QVariant(false)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/gridview.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), (i%3)*80.); + QCOMPARE(item->y(), (i/3)*60.); + } + + // Position on a currently visible item + gridview->positionViewAtIndex(4); + QCOMPARE(gridview->contentY(), 60.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), (i%3)*80.); + QCOMPARE(item->y(), (i/3)*60.); + } + + // Position on an item beyond the visible items + gridview->positionViewAtIndex(21); + QCOMPARE(gridview->contentY(), 420.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), (i%3)*80.); + QCOMPARE(item->y(), (i/3)*60.); + } + + // Position on an item that would leave empty space if positioned at the top + gridview->positionViewAtIndex(31); + QCOMPARE(gridview->contentY(), 520.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), (i%3)*80.); + QCOMPARE(item->y(), (i/3)*60.); + } + + // Position at the beginning again + gridview->positionViewAtIndex(0); + QCOMPARE(gridview->contentY(), 0.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->x(), (i%3)*80.); + QCOMPARE(item->y(), (i/3)*60.); + } + + delete canvas; +} + +void tst_QDeclarativeGridView::resetModel() +{ + QDeclarativeView *canvas = createView(); + + QStringList strings; + strings << "one" << "two" << "three"; + QStringListModel model(strings); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaygrid.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QDeclarativeItem *viewport = gridview->viewport(); + QVERIFY(viewport != 0); + + QCOMPARE(gridview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } + + strings.clear(); + strings << "four" << "five" << "six" << "seven"; + model.setStringList(strings); + + QCOMPARE(gridview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } +} + +void tst_QDeclarativeGridView::QTBUG_8456() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/setindex.qml")); + qApp->processEvents(); + + QDeclarativeGridView *gridview = findItem<QDeclarativeGridView>(canvas->rootObject(), "grid"); + QVERIFY(gridview != 0); + + QCOMPARE(gridview->currentIndex(), 0); +} + +QDeclarativeView *tst_QDeclarativeGridView::createView() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + return canvas; +} + +/* + Find an item with the specified objectName. If index is supplied then the + item must also evaluate the {index} expression equal to index +*/ +template<typename T> +T *tst_QDeclarativeGridView::findItem(QGraphicsObject *parent, const QString &objectName, int index) +{ + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + if (index != -1) { + QDeclarativeContext *context = QDeclarativeEngine::contextForObject(item); + if (context) { + if (context->contextProperty("index").toInt() == index) { + return static_cast<T*>(item); + } + } + } else { + return static_cast<T*>(item); + } + } + item = findItem<T>(item, objectName, index); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + +template<typename T> +QList<T*> tst_QDeclarativeGridView::findItems(QGraphicsObject *parent, const QString &objectName) +{ + QList<T*> items; + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + items.append(static_cast<T*>(item)); + //qDebug() << " found:" << item; + } + items += findItems<T>(item, objectName); + } + + return items; +} + +void tst_QDeclarativeGridView::dumpTree(QDeclarativeItem *parent, int depth) +{ + static QString padding(" "); + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + QDeclarativeContext *context = QDeclarativeEngine::contextForObject(item); + qDebug() << padding.left(depth*2) << item << (context ? context->contextProperty("index").toInt() : -1); + dumpTree(item, depth+1); + } +} + + +QTEST_MAIN(tst_QDeclarativeGridView) + +#include "tst_qdeclarativegridview.moc" diff --git a/tests/auto/declarative/qmlgraphicsimage/data/colors.png b/tests/auto/declarative/qdeclarativeimage/data/colors.png Binary files differindex dfb62f3..dfb62f3 100644 --- a/tests/auto/declarative/qmlgraphicsimage/data/colors.png +++ b/tests/auto/declarative/qdeclarativeimage/data/colors.png diff --git a/tests/auto/declarative/qmlgraphicsborderimage/data/colors.png b/tests/auto/declarative/qdeclarativeimage/data/colors1.png Binary files differindex dfb62f3..dfb62f3 100644 --- a/tests/auto/declarative/qmlgraphicsborderimage/data/colors.png +++ b/tests/auto/declarative/qdeclarativeimage/data/colors1.png diff --git a/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro new file mode 100644 index 0000000..7634c12 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativeimage.cpp ../shared/testhttpserver.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp new file mode 100644 index 0000000..ed2095b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -0,0 +1,253 @@ +/**************************************************************************** +** +** 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 <QTextDocument> +#include <QTcpServer> +#include <QTcpSocket> +#include <QDir> + +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeimage_p.h> +#include <private/qdeclarativeimagebase_p.h> +#include <private/qdeclarativeloader_p.h> +#include <QtDeclarative/qdeclarativecontext.h> + +#include "../shared/testhttpserver.h" + + +#define SERVER_PORT 14445 +#define SERVER_ADDR "http://127.0.0.1:14445" + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 60; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + + +class tst_qdeclarativeimage : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativeimage(); + +private slots: + void noSource(); + void imageSource(); + void imageSource_data(); + void clearSource(); + void resized(); + void smooth(); + void pixmap(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativeimage::tst_qdeclarativeimage() +{ +} + +void tst_qdeclarativeimage::noSource() +{ + QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->source(), QUrl()); + QVERIFY(obj->status() == QDeclarativeImage::Null); + QCOMPARE(obj->width(), 0.); + QCOMPARE(obj->height(), 0.); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + QCOMPARE(obj->progress(), 0.0); + + delete obj; +} + +void tst_qdeclarativeimage::imageSource_data() +{ + QTest::addColumn<QString>("source"); + QTest::addColumn<bool>("remote"); + QTest::addColumn<bool>("async"); + QTest::addColumn<QString>("error"); + + QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << false << ""; + QTest::newRow("local async") << QUrl::fromLocalFile(SRCDIR "/data/colors1.png").toString() << false << true << ""; + QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false + << false << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; + QTest::newRow("local async not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() << false + << true << "\"Cannot open: " + QUrl::fromLocalFile(SRCDIR "/data/no-such-file-1.png").toString() + "\" "; + QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << false << ""; + QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true << false + << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; +} + +void tst_qdeclarativeimage::imageSource() +{ + QFETCH(QString, source); + QFETCH(bool, remote); + QFETCH(bool, async); + QFETCH(QString, error); + + TestHTTPServer server(SERVER_PORT); + if (remote) { + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + } + + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + + QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\"; asynchronous: " + + (async ? QLatin1String("true") : QLatin1String("false")) + " }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + + if (remote || async) + TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + + QCOMPARE(obj->source(), remote ? source : QUrl(source)); + + if (error.isEmpty()) { + TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + QCOMPARE(obj->width(), 120.); + QCOMPARE(obj->height(), 120.); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + QCOMPARE(obj->progress(), 1.0); + } else { + TRY_WAIT(obj->status() == QDeclarativeImage::Error); + } + + delete obj; +} + +void tst_qdeclarativeimage::clearSource() +{ + QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QVERIFY(obj->status() == QDeclarativeImage::Ready); + QCOMPARE(obj->width(), 120.); + QCOMPARE(obj->height(), 120.); + QCOMPARE(obj->progress(), 1.0); + + ctxt->setContextProperty("srcImage", ""); + QVERIFY(obj->source().isEmpty()); + QVERIFY(obj->status() == QDeclarativeImage::Null); + QCOMPARE(obj->width(), 0.); + QCOMPARE(obj->height(), 0.); + QCOMPARE(obj->progress(), 0.0); +} + +void tst_qdeclarativeimage::resized() +{ + QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeimage::smooth() +{ + QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->width(), 300.); + QCOMPARE(obj->height(), 300.); + QCOMPARE(obj->smooth(), true); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + + delete obj; +} + +void tst_qdeclarativeimage::pixmap() +{ + QString componentStr = "import Qt 4.6\nImage { pixmap: testPixmap }"; + + QPixmap pixmap; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty("testPixmap", pixmap); + + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + QCOMPARE(obj->source(), QUrl()); + QVERIFY(obj->status() == QDeclarativeImage::Null); + QCOMPARE(obj->width(), 0.); + QCOMPARE(obj->height(), 0.); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + QCOMPARE(obj->progress(), 0.0); + QVERIFY(obj->pixmap().isNull()); + + pixmap = QPixmap(SRCDIR "/data/colors.png"); + ctxt->setContextProperty("testPixmap", pixmap); + QCOMPARE(obj->width(), 120.); + QCOMPARE(obj->height(), 120.); + QVERIFY(obj->status() == QDeclarativeImage::Ready); + + delete obj; +} + +QTEST_MAIN(tst_qdeclarativeimage) + +#include "tst_qdeclarativeimage.moc" diff --git a/tests/auto/declarative/qmlpixmapcache/data/exists.png b/tests/auto/declarative/qdeclarativeimageprovider/data/exists.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlpixmapcache/data/exists.png +++ b/tests/auto/declarative/qdeclarativeimageprovider/data/exists.png diff --git a/tests/auto/declarative/qmlpixmapcache/data/exists1.png b/tests/auto/declarative/qdeclarativeimageprovider/data/exists1.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlpixmapcache/data/exists1.png +++ b/tests/auto/declarative/qdeclarativeimageprovider/data/exists1.png diff --git a/tests/auto/declarative/qmlpixmapcache/data/exists2.png b/tests/auto/declarative/qdeclarativeimageprovider/data/exists2.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlpixmapcache/data/exists2.png +++ b/tests/auto/declarative/qdeclarativeimageprovider/data/exists2.png diff --git a/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro new file mode 100644 index 0000000..a4d3eb2 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimageprovider/qdeclarativeimageprovider.pro @@ -0,0 +1,12 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeimageprovider.cpp + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp new file mode 100644 index 0000000..c5bdfc8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeimageprovider/tst_qdeclarativeimageprovider.cpp @@ -0,0 +1,166 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <QtTest/QtTest> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativeimageprovider.h> +#include <private/qdeclarativeimage_p.h> + +// QDeclarativeImageProvider::request() is run in an idle thread where possible +// Be generous in our timeout. +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 10; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(100); \ + } \ + QVERIFY((expr)); \ + } while (false) + + +class tst_qdeclarativeimageprovider : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeimageprovider() + { + } + +private slots: + void imageSource(); + void imageSource_data(); + void removeProvider(); + +private: + QDeclarativeEngine engine; +}; + +class TestProvider : public QDeclarativeImageProvider +{ +public: + QImage request(const QString &id) { + QImage image; + image.load(SRCDIR "/data/" + id); + return image; + } +}; + +void tst_qdeclarativeimageprovider::imageSource_data() +{ + QTest::addColumn<QString>("source"); + QTest::addColumn<QString>("error"); + + QTest::newRow("exists") << "image://test/exists.png" << ""; + QTest::newRow("missing") << "image://test/no-such-file.png" + << "\"Failed to get image from provider: image://test/no-such-file.png\" "; + QTest::newRow("unknown provider") << "image://bogus/exists.png" + << "\"Failed to get image from provider: image://bogus/exists.png\" "; +} + +void tst_qdeclarativeimageprovider::imageSource() +{ + QFETCH(QString, source); + QFETCH(QString, error); + + if (!error.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + + engine.addImageProvider("test", new TestProvider); + QVERIFY(engine.imageProvider("test") != 0); + + QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + + TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + + QCOMPARE(obj->source(), QUrl(source)); + + if (error.isEmpty()) { + TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + QCOMPARE(obj->width(), 100.); + QCOMPARE(obj->height(), 100.); + QCOMPARE(obj->fillMode(), QDeclarativeImage::Stretch); + QCOMPARE(obj->progress(), 1.0); + } else { + TRY_WAIT(obj->status() == QDeclarativeImage::Error); + } + + delete obj; +} + +void tst_qdeclarativeimageprovider::removeProvider() +{ + engine.addImageProvider("test2", new TestProvider); + QVERIFY(engine.imageProvider("test2") != 0); + + // add provider, confirm it works + QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeImage *obj = qobject_cast<QDeclarativeImage*>(component.create()); + QVERIFY(obj != 0); + + TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + TRY_WAIT(obj->status() == QDeclarativeImage::Ready); + + QCOMPARE(obj->width(), 100.0); + + // remove the provider and confirm + QString error("\"Failed to get image from provider: image://test2/exists2.png\" "); + QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); + + engine.removeImageProvider("test2"); + + obj->setSource(QUrl("image://test2/exists2.png")); + + TRY_WAIT(obj->status() == QDeclarativeImage::Loading); + TRY_WAIT(obj->status() == QDeclarativeImage::Error); + + delete obj; +} + + +QTEST_MAIN(tst_qdeclarativeimageprovider) + +#include "tst_qdeclarativeimageprovider.moc" diff --git a/tests/auto/declarative/qmlinfo/data/NestedObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml index cd5b426..cd5b426 100644 --- a/tests/auto/declarative/qmlinfo/data/NestedObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/NestedObject.qml diff --git a/tests/auto/declarative/qmlinfo/data/nestedQmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml index a2ce78a..a2ce78a 100644 --- a/tests/auto/declarative/qmlinfo/data/nestedQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/nestedQmlObject.qml diff --git a/tests/auto/declarative/qmlinfo/data/qmlObject.qml b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml index ce05f89..ce05f89 100644 --- a/tests/auto/declarative/qmlinfo/data/qmlObject.qml +++ b/tests/auto/declarative/qdeclarativeinfo/data/qmlObject.qml diff --git a/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro new file mode 100644 index 0000000..015c094 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeinfo/qdeclarativeinfo.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeinfo.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp new file mode 100644 index 0000000..aa3f03b --- /dev/null +++ b/tests/auto/declarative/qdeclarativeinfo/tst_qdeclarativeinfo.cpp @@ -0,0 +1,139 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QPushButton> +#include <QDeclarativeContext> +#include <qdeclarativeinfo.h> + +class tst_qdeclarativeinfo : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeinfo() {} + +private slots: + void qmlObject(); + void nestedQmlObject(); + void nonQmlObject(); + void nullObject(); + void nonQmlContextedObject(); + +private: + QDeclarativeEngine engine; +}; + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +void tst_qdeclarativeinfo::qmlObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("qmlObject.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QString message = "QML QObject_QML_0 (" + component.url().toString() + ":3:1) Test Message"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(object) << "Test Message"; + + QObject *nested = qvariant_cast<QObject *>(object->property("nested")); + QVERIFY(nested != 0); + + message = "QML QtObject (" + component.url().toString() + ":6:13) Second Test Message"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(nested) << "Second Test Message"; +} + +void tst_qdeclarativeinfo::nestedQmlObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("nestedQmlObject.qml")); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QObject *nested = qvariant_cast<QObject *>(object->property("nested")); + QVERIFY(nested != 0); + QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2")); + QVERIFY(nested2 != 0); + + QString message = "QML NestedObject (" + component.url().toString() + ":5:13) Outer Object"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(nested) << "Outer Object"; + + message = "QML QtObject (" + TEST_FILE("NestedObject.qml").toString() + ":6:14) Inner Object"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + qmlInfo(nested2) << "Inner Object"; +} + +void tst_qdeclarativeinfo::nonQmlObject() +{ + QObject object; + QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message"); + qmlInfo(&object) << "Test Message"; + + QPushButton pbObject; + QTest::ignoreMessage(QtWarningMsg, "QML QPushButton (unknown location) Test Message"); + qmlInfo(&pbObject) << "Test Message"; +} + +void tst_qdeclarativeinfo::nullObject() +{ + QTest::ignoreMessage(QtWarningMsg, "QML (unknown location) Null Object Test Message"); + qmlInfo(0) << "Null Object Test Message"; +} + +void tst_qdeclarativeinfo::nonQmlContextedObject() +{ + QObject object; + QDeclarativeContext context(&engine); + QDeclarativeEngine::setContextForObject(&object, &context); + QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message"); + qmlInfo(&object) << "Test Message"; +} + +QTEST_MAIN(tst_qdeclarativeinfo) + +#include "tst_qdeclarativeinfo.moc" diff --git a/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro new file mode 100644 index 0000000..b8f7d27 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeinstruction/qdeclarativeinstruction.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative script +SOURCES += tst_qdeclarativeinstruction.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp new file mode 100644 index 0000000..636c5e3 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeinstruction/tst_qdeclarativeinstruction.cpp @@ -0,0 +1,585 @@ +/**************************************************************************** +** +** 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 <private/qdeclarativecompiler_p.h> + +class tst_qdeclarativeinstruction : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeinstruction() {} + +private slots: + void dump(); +}; + +static QStringList messages; +static void msgHandler(QtMsgType, const char *msg) +{ + messages << QLatin1String(msg); +} + +void tst_qdeclarativeinstruction::dump() +{ + QDeclarativeCompiledData *data = new QDeclarativeCompiledData(0); + { + QDeclarativeInstruction i; + i.line = 0; + i.type = QDeclarativeInstruction::Init; + i.init.bindingsSize = 0; + i.init.parserStatusSize = 3; + i.init.contextCache = -1; + i.init.compiledBinding = -1; + data->bytecode << i; + } + + { + QDeclarativeCompiledData::TypeReference ref; + ref.className = "Test"; + data->types << ref; + + QDeclarativeInstruction i; + i.line = 1; + i.type = QDeclarativeInstruction::CreateObject; + i.create.type = 0; + i.create.data = -1; + i.create.bindingBits = -1; + i.create.column = 10; + data->bytecode << i; + } + + { + data->primitives << "testId"; + + QDeclarativeInstruction i; + i.line = 2; + i.type = QDeclarativeInstruction::SetId; + i.setId.value = 0; + i.setId.index = 0; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 3; + i.type = QDeclarativeInstruction::SetDefault; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 4; + i.type = QDeclarativeInstruction::CreateComponent; + i.createComponent.count = 3; + i.createComponent.column = 4; + i.createComponent.endLine = 14; + i.createComponent.metaObject = 0; + + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 5; + i.type = QDeclarativeInstruction::StoreMetaObject; + i.storeMeta.data = 3; + i.storeMeta.aliasData = 6; + i.storeMeta.propertyCache = 7; + + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 6; + i.type = QDeclarativeInstruction::StoreFloat; + i.storeFloat.propertyIndex = 3; + i.storeFloat.value = 11.3; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 7; + i.type = QDeclarativeInstruction::StoreDouble; + i.storeDouble.propertyIndex = 4; + i.storeDouble.value = 14.8; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 8; + i.type = QDeclarativeInstruction::StoreInteger; + i.storeInteger.propertyIndex = 5; + i.storeInteger.value = 9; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 9; + i.type = QDeclarativeInstruction::StoreBool; + i.storeBool.propertyIndex = 6; + i.storeBool.value = true; + + data->bytecode << i; + } + + { + data->primitives << "Test String"; + QDeclarativeInstruction i; + i.line = 10; + i.type = QDeclarativeInstruction::StoreString; + i.storeString.propertyIndex = 7; + i.storeString.value = 1; + data->bytecode << i; + } + + { + data->primitives << "http://www.nokia.com"; + QDeclarativeInstruction i; + i.line = 11; + i.type = QDeclarativeInstruction::StoreUrl; + i.storeUrl.propertyIndex = 8; + i.storeUrl.value = 2; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 12; + i.type = QDeclarativeInstruction::StoreColor; + i.storeColor.propertyIndex = 9; + i.storeColor.value = 0xFF00FF00; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 13; + i.type = QDeclarativeInstruction::StoreDate; + i.storeDate.propertyIndex = 10; + i.storeDate.value = 9; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 14; + i.type = QDeclarativeInstruction::StoreTime; + i.storeTime.propertyIndex = 11; + i.storeTime.valueIndex = 33; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 15; + i.type = QDeclarativeInstruction::StoreDateTime; + i.storeDateTime.propertyIndex = 12; + i.storeDateTime.valueIndex = 44; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 16; + i.type = QDeclarativeInstruction::StorePoint; + i.storeRealPair.propertyIndex = 13; + i.storeRealPair.valueIndex = 3; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 17; + i.type = QDeclarativeInstruction::StorePointF; + i.storeRealPair.propertyIndex = 14; + i.storeRealPair.valueIndex = 9; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 18; + i.type = QDeclarativeInstruction::StoreSize; + i.storeRealPair.propertyIndex = 15; + i.storeRealPair.valueIndex = 8; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 19; + i.type = QDeclarativeInstruction::StoreSizeF; + i.storeRealPair.propertyIndex = 16; + i.storeRealPair.valueIndex = 99; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 20; + i.type = QDeclarativeInstruction::StoreRect; + i.storeRect.propertyIndex = 17; + i.storeRect.valueIndex = 2; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 21; + i.type = QDeclarativeInstruction::StoreRectF; + i.storeRect.propertyIndex = 18; + i.storeRect.valueIndex = 19; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 22; + i.type = QDeclarativeInstruction::StoreVector3D; + i.storeVector3D.propertyIndex = 19; + i.storeVector3D.valueIndex = 9; + data->bytecode << i; + } + + { + data->primitives << "color(1, 1, 1, 1)"; + QDeclarativeInstruction i; + i.line = 23; + i.type = QDeclarativeInstruction::StoreVariant; + i.storeString.propertyIndex = 20; + i.storeString.value = 3; + + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 24; + i.type = QDeclarativeInstruction::StoreObject; + i.storeObject.propertyIndex = 21; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 25; + i.type = QDeclarativeInstruction::StoreVariantObject; + i.storeObject.propertyIndex = 22; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 26; + i.type = QDeclarativeInstruction::StoreInterface; + i.storeObject.propertyIndex = 23; + data->bytecode << i; + } + + { + data->primitives << "console.log(1921)"; + + QDeclarativeInstruction i; + i.line = 27; + i.type = QDeclarativeInstruction::StoreSignal; + i.storeSignal.signalIndex = 2; + i.storeSignal.value = 4; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 28; + i.type = QDeclarativeInstruction::StoreScript; + i.storeScript.value = 2; + //i.storeScript.fileName = 18; + //i.storeScript.lineNumber = 28; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 29; + i.type = QDeclarativeInstruction::StoreScriptString; + i.storeScriptString.propertyIndex = 24; + i.storeScriptString.value = 3; + i.storeScriptString.scope = 1; + data->bytecode << i; + } + + { + data->datas << "mySignal"; + + QDeclarativeInstruction i; + i.line = 30; + i.type = QDeclarativeInstruction::AssignSignalObject; + i.assignSignalObject.signal = 0; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 31; + i.type = QDeclarativeInstruction::AssignCustomType; + i.assignCustomType.propertyIndex = 25; + i.assignCustomType.valueIndex = 4; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 32; + i.type = QDeclarativeInstruction::StoreBinding; + i.assignBinding.property = 26; + i.assignBinding.value = 3; + i.assignBinding.context = 2; + i.assignBinding.owner = 0; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 33; + i.type = QDeclarativeInstruction::StoreCompiledBinding; + i.assignBinding.property = 27; + i.assignBinding.value = 2; + i.assignBinding.context = 4; + i.assignBinding.owner = 0; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 34; + i.type = QDeclarativeInstruction::StoreValueSource; + i.assignValueSource.property = 29; + i.assignValueSource.owner = 1; + i.assignValueSource.castValue = 4; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 35; + i.type = QDeclarativeInstruction::StoreValueInterceptor; + i.assignValueInterceptor.property = 30; + i.assignValueInterceptor.owner = 2; + i.assignValueInterceptor.castValue = -4; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 36; + i.type = QDeclarativeInstruction::BeginObject; + i.begin.castValue = 4; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 38; + i.type = QDeclarativeInstruction::StoreObjectQList; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 39; + i.type = QDeclarativeInstruction::AssignObjectList; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 40; + i.type = QDeclarativeInstruction::FetchAttached; + i.fetchAttached.id = 23; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 42; + i.type = QDeclarativeInstruction::FetchQList; + i.fetch.property = 32; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 43; + i.type = QDeclarativeInstruction::FetchObject; + i.fetch.property = 33; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 44; + i.type = QDeclarativeInstruction::FetchValueType; + i.fetchValue.property = 34; + i.fetchValue.type = 6; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 45; + i.type = QDeclarativeInstruction::PopFetchedObject; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 46; + i.type = QDeclarativeInstruction::PopQList; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 47; + i.type = QDeclarativeInstruction::PopValueType; + i.fetchValue.property = 35; + i.fetchValue.type = 8; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 48; + i.type = QDeclarativeInstruction::Defer; + i.defer.deferCount = 7; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = -1; + i.type = QDeclarativeInstruction::Defer; + i.defer.deferCount = 7; + data->bytecode << i; + } + + { + QDeclarativeInstruction i; + i.line = 50; + i.type = (QDeclarativeInstruction::Type)(QDeclarativeInstruction::Defer + 1); // Non-existant + data->bytecode << i; + } + + QStringList expect; + expect + << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments" + << "-------------------------------------------------------------------------------" + << "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1" + << "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\"" + << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\"" + << "3\t\t3\tSET_DEFAULT" + << "4\t\t4\tCREATE_COMPONENT\t3" + << "5\t\t5\tSTORE_META\t\t3" + << "6\t\t6\tSTORE_FLOAT\t\t3\t11.3" + << "7\t\t7\tSTORE_DOUBLE\t\t4\t14.8" + << "8\t\t8\tSTORE_INTEGER\t\t5\t9" + << "9\t\t9\tSTORE_BOOL\t\t6\ttrue" + << "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" + << "11\t\t11\tSTORE_URL\t\t8\t2\t\t\"http://www.nokia.com\"" + << "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" + << "13\t\t13\tSTORE_DATE\t\t10\t9" + << "14\t\t14\tSTORE_TIME\t\t11\t33" + << "15\t\t15\tSTORE_DATETIME\t\t12\t44" + << "16\t\t16\tSTORE_POINT\t\t13\t3" + << "17\t\t17\tSTORE_POINTF\t\t14\t9" + << "18\t\t18\tSTORE_SIZE\t\t15\t8" + << "19\t\t19\tSTORE_SIZEF\t\t16\t99" + << "20\t\t20\tSTORE_RECT\t\t17\t2" + << "21\t\t21\tSTORE_RECTF\t\t18\t19" + << "22\t\t22\tSTORE_VECTOR3D\t\t19\t9" + << "23\t\t23\tSTORE_VARIANT\t\t20\t3\t\t\"color(1, 1, 1, 1)\"" + << "24\t\t24\tSTORE_OBJECT\t\t21" + << "25\t\t25\tSTORE_VARIANT_OBJECT\t22" + << "26\t\t26\tSTORE_INTERFACE\t\t23" + << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"console.log(1921)\"" + << "28\t\t28\tSTORE_SCRIPT\t\t2" + << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1" + << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" + << "31\t\t31\tASSIGN_CUSTOMTYPE\t25\t4" + << "32\t\t32\tSTORE_BINDING\t26\t3\t2" + << "33\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4" + << "34\t\t34\tSTORE_VALUE_SOURCE\t29\t4" + << "35\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4" + << "36\t\t36\tBEGIN\t\t\t4" + << "37\t\t38\tSTORE_OBJECT_QLIST" + << "38\t\t39\tASSIGN_OBJECT_LIST" + << "39\t\t40\tFETCH_ATTACHED\t\t23" + << "40\t\t42\tFETCH_QLIST\t\t32" + << "41\t\t43\tFETCH\t\t\t33" + << "42\t\t44\tFETCH_VALUE\t\t34\t6" + << "43\t\t45\tPOP" + << "44\t\t46\tPOP_QLIST" + << "45\t\t47\tPOP_VALUE\t\t35\t8" + << "46\t\t48\tDEFER\t\t\t7" + << "47\t\tNA\tDEFER\t\t\t7" + << "48\t\t50\tXXX UNKOWN INSTRUCTION\t47" + << "-------------------------------------------------------------------------------"; + + messages = QStringList(); + QtMsgHandler old = qInstallMsgHandler(msgHandler); + data->dumpInstructions(); + qInstallMsgHandler(old); + + QCOMPARE(messages.count(), expect.count()); + for (int ii = 0; ii < messages.count(); ++ii) { + QCOMPARE(messages.at(ii), expect.at(ii)); + } + + data->release(); +} + +QTEST_MAIN(tst_qdeclarativeinstruction) + +#include "tst_qdeclarativeinstruction.moc" diff --git a/tests/auto/declarative/qmlgraphicsitem/data/keynavigation.qml b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml index 9281a17..9281a17 100644 --- a/tests/auto/declarative/qmlgraphicsitem/data/keynavigation.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keynavigation.qml diff --git a/tests/auto/declarative/qmlgraphicsitem/data/keys.qml b/tests/auto/declarative/qdeclarativeitem/data/keys.qml index f3c1f7b..f3c1f7b 100644 --- a/tests/auto/declarative/qmlgraphicsitem/data/keys.qml +++ b/tests/auto/declarative/qdeclarativeitem/data/keys.qml diff --git a/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro new file mode 100644 index 0000000..0eb2141 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/qdeclarativeitem.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeitem.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp new file mode 100644 index 0000000..36dcf1f --- /dev/null +++ b/tests/auto/declarative/qdeclarativeitem/tst_qdeclarativeitem.cpp @@ -0,0 +1,318 @@ +/**************************************************************************** +** +** 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 <QtTest/QSignalSpy> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <QtDeclarative/qdeclarativeitem.h> + +class tst_QDeclarativeItem : public QObject + +{ + Q_OBJECT +public: + tst_QDeclarativeItem(); + +private slots: + void keys(); + void keyNavigation(); + void smooth(); + void clip(); + +private: + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &objectName); + QDeclarativeEngine engine; +}; + +class KeysTestObject : public QObject +{ + Q_OBJECT +public: + KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0) {} + + void reset() { + mKey = 0; + mText = QString(); + mModifiers = 0; + mForwardedKey = 0; + } + +public slots: + void keyPress(int key, QString text, int modifiers) { + mKey = key; + mText = text; + mModifiers = modifiers; + } + void keyRelease(int key, QString text, int modifiers) { + mKey = key; + mText = text; + mModifiers = modifiers; + } + void forwardedKey(int key) { + mForwardedKey = key; + } + +public: + int mKey; + QString mText; + int mModifiers; + int mForwardedKey; + +private: +}; + + +tst_QDeclarativeItem::tst_QDeclarativeItem() +{ +} + +void tst_QDeclarativeItem::keys() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + KeysTestObject *testObject = new KeysTestObject; + canvas->rootContext()->setContextProperty("keysTestObject", testObject); + + canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); + canvas->show(); + qApp->processEvents(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_A)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A)); + QCOMPARE(testObject->mText, QLatin1String("A")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(!key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier, "A", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_A)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A)); + QCOMPARE(testObject->mText, QLatin1String("A")); + QVERIFY(testObject->mModifiers == Qt::ShiftModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_Return)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Return)); + QCOMPARE(testObject->mText, QLatin1String("Return")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_0, Qt::NoModifier, "0", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_0)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_0)); + QCOMPARE(testObject->mText, QLatin1String("0")); + QVERIFY(testObject->mModifiers == Qt::NoModifier); + QVERIFY(key.isAccepted()); + + testObject->reset(); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_9, Qt::NoModifier, "9", false, 1); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, int(Qt::Key_9)); + QCOMPARE(testObject->mForwardedKey, int(Qt::Key_9)); + QCOMPARE(testObject->mText, QLatin1String("9")); + 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); + QApplication::sendEvent(canvas, &key); + QCOMPARE(testObject->mKey, 0); + QVERIFY(!key.isAccepted()); + + delete canvas; + delete testObject; +} + +void tst_QDeclarativeItem::keyNavigation() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml")); + canvas->show(); + qApp->processEvents(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(canvas->rootObject(), "item1"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // right + QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QDeclarativeItem>(canvas->rootObject(), "item2"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // down + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QDeclarativeItem>(canvas->rootObject(), "item4"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // left + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + + item = findItem<QDeclarativeItem>(canvas->rootObject(), "item3"); + QVERIFY(item); + QVERIFY(item->hasFocus()); + + // up + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, 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() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QSignalSpy spy(item, SIGNAL(smoothChanged())); + + QVERIFY(item); + QVERIFY(!item->smooth()); + + item->setSmooth(true); + QVERIFY(item->smooth()); + QCOMPARE(spy.count(),1); + item->setSmooth(true); + QCOMPARE(spy.count(),1); + + item->setSmooth(false); + QVERIFY(!item->smooth()); + QCOMPARE(spy.count(),2); + item->setSmooth(false); + QCOMPARE(spy.count(),2); +} + +void tst_QDeclarativeItem::clip() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QSignalSpy spy(item, SIGNAL(clipChanged())); + + QVERIFY(item); + QVERIFY(!item->clip()); + + item->setClip(true); + QVERIFY(item->clip()); + QCOMPARE(spy.count(),1); + item->setClip(true); + QCOMPARE(spy.count(),1); + + item->setClip(false); + QVERIFY(!item->clip()); + QCOMPARE(spy.count(),2); + item->setClip(false); + QCOMPARE(spy.count(),2); +} + +template<typename T> +T *tst_QDeclarativeItem::findItem(QGraphicsObject *parent, const QString &objectName) +{ + if (!parent) + return 0; + + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + return static_cast<T*>(item); + item = findItem<T>(item, objectName); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + + + +QTEST_MAIN(tst_QDeclarativeItem) + +#include "tst_qdeclarativeitem.moc" diff --git a/tests/auto/declarative/qmllanguage/data/Alias.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml index 55aa231..55aa231 100644 --- a/tests/auto/declarative/qmllanguage/data/Alias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias.qml diff --git a/tests/auto/declarative/qmllanguage/data/Alias2.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml index 6362b2d..6362b2d 100644 --- a/tests/auto/declarative/qmllanguage/data/Alias2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias2.qml diff --git a/tests/auto/declarative/qmllanguage/data/Alias3.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml index d1e78f8..d1e78f8 100644 --- a/tests/auto/declarative/qmllanguage/data/Alias3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias3.qml diff --git a/tests/auto/declarative/qmllanguage/data/Alias4.qml b/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml index 573674c..573674c 100644 --- a/tests/auto/declarative/qmllanguage/data/Alias4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/Alias4.qml diff --git a/tests/auto/declarative/qmllanguage/data/ComponentComposite.qml b/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml index 05fbc3f..05fbc3f 100644 --- a/tests/auto/declarative/qmllanguage/data/ComponentComposite.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/ComponentComposite.qml diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml index 99d010f..99d010f 100644 --- a/tests/auto/declarative/qmllanguage/data/CompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType.qml diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType2.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType2.qml index 86210e9..86210e9 100644 --- a/tests/auto/declarative/qmllanguage/data/CompositeType2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType2.qml diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType3.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml index d08f35b..d08f35b 100644 --- a/tests/auto/declarative/qmllanguage/data/CompositeType3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType3.qml diff --git a/tests/auto/declarative/qmllanguage/data/CompositeType4.qml b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType4.qml index a6a8168..a6a8168 100644 --- a/tests/auto/declarative/qmllanguage/data/CompositeType4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/CompositeType4.qml diff --git a/tests/auto/declarative/qmllanguage/data/DynamicPropertiesNestedType.qml b/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml index aefbf9a..aefbf9a 100644 --- a/tests/auto/declarative/qmllanguage/data/DynamicPropertiesNestedType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/DynamicPropertiesNestedType.qml diff --git a/tests/auto/declarative/qmllanguage/data/HelperAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml index dc3b382..dc3b382 100644 --- a/tests/auto/declarative/qmllanguage/data/HelperAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/HelperAlias.qml diff --git a/tests/auto/declarative/qmllanguage/data/I18n.qml b/tests/auto/declarative/qdeclarativelanguage/data/I18n.qml index 558c836..558c836 100644 --- a/tests/auto/declarative/qmllanguage/data/I18n.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/I18n.qml diff --git a/tests/auto/declarative/qmllanguage/data/I18nType30.qml b/tests/auto/declarative/qdeclarativelanguage/data/I18nType30.qml index 42dbc69..42dbc69 100644 --- a/tests/auto/declarative/qmllanguage/data/I18nType30.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/I18nType30.qml diff --git a/tests/auto/declarative/qmllanguage/data/MyComponent.qml b/tests/auto/declarative/qdeclarativelanguage/data/MyComponent.qml index 1a23277..1a23277 100644 --- a/tests/auto/declarative/qmllanguage/data/MyComponent.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/MyComponent.qml diff --git a/tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml b/tests/auto/declarative/qdeclarativelanguage/data/MyCompositeValueSource.qml index e620e26..e620e26 100644 --- a/tests/auto/declarative/qmllanguage/data/MyCompositeValueSource.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/MyCompositeValueSource.qml diff --git a/tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml b/tests/auto/declarative/qdeclarativelanguage/data/MyContainerComponent.qml index 61f54c5..61f54c5 100644 --- a/tests/auto/declarative/qmllanguage/data/MyContainerComponent.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/MyContainerComponent.qml diff --git a/tests/auto/declarative/qmllanguage/data/NestedAlias.qml b/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml index 5155612..5155612 100644 --- a/tests/auto/declarative/qmllanguage/data/NestedAlias.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/NestedAlias.qml diff --git a/tests/auto/declarative/qmllanguage/data/NestedErrorsType.qml b/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml index 5cc8d20..5cc8d20 100644 --- a/tests/auto/declarative/qmllanguage/data/NestedErrorsType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/NestedErrorsType.qml diff --git a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml b/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml index 2889caf..2889caf 100644 --- a/tests/auto/declarative/qmllanguage/data/OnCompletedType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/OnCompletedType.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml index 500b0f6..500b0f6 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.2.qml index 5c92270..5c92270 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml index e059937..e059937 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.4.qml index bd6a769..bd6a769 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml index 4316d0d..4316d0d 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml index e3af230..e3af230 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml index a9a57eb..a9a57eb 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.7.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml index 2b9ad85..2b9ad85 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.8.qml diff --git a/tests/auto/declarative/qmllanguage/data/alias.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml index a2a41a1..a2a41a1 100644 --- a/tests/auto/declarative/qmllanguage/data/alias.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/alias.9.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml index c86c96b..c86c96b 100644 --- a/tests/auto/declarative/qmllanguage/data/assignBasicTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignBasicTypes.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml index f6422bd..f6422bd 100644 --- a/tests/auto/declarative/qmllanguage/data/assignCompositeToType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignCompositeToType.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralSignalProperty.qml index 399fcea..399fcea 100644 --- a/tests/auto/declarative/qmllanguage/data/assignLiteralSignalProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignLiteralSignalProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToSignal.qml index 789cc66..789cc66 100644 --- a/tests/auto/declarative/qmllanguage/data/assignObjectToSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToSignal.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml index 0ff9370..0ff9370 100644 --- a/tests/auto/declarative/qmllanguage/data/assignObjectToVariant.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignObjectToVariant.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignQmlComponent.qml index 20bdc55..20bdc55 100644 --- a/tests/auto/declarative/qmllanguage/data/assignQmlComponent.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignQmlComponent.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignSignal.qml index 2a48df8..2a48df8 100644 --- a/tests/auto/declarative/qmllanguage/data/assignSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignSignal.qml diff --git a/tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml b/tests/auto/declarative/qdeclarativelanguage/data/assignTypeExtremes.qml index 60ede52..60ede52 100644 --- a/tests/auto/declarative/qmllanguage/data/assignTypeExtremes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/assignTypeExtremes.qml diff --git a/tests/auto/declarative/qmllanguage/data/attachedProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml index b46ec34..b46ec34 100644 --- a/tests/auto/declarative/qmllanguage/data/attachedProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/attachedProperties.qml diff --git a/tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml b/tests/auto/declarative/qdeclarativelanguage/data/autoComponentCreation.qml index 5d00144..5d00144 100644 --- a/tests/auto/declarative/qmllanguage/data/autoComponentCreation.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/autoComponentCreation.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/autoNotifyConnection.qml b/tests/auto/declarative/qdeclarativelanguage/data/autoNotifyConnection.qml new file mode 100644 index 0000000..640fb54 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/autoNotifyConnection.qml @@ -0,0 +1,6 @@ +import Test 1.0 +MyQmlObject { + property bool receivedNotify : false + onPropertyWithNotifyChanged: { receivedNotify = true; } +} + diff --git a/tests/auto/declarative/qmllanguage/data/component.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.1.errors.txt index 091aad6..091aad6 100644 --- a/tests/auto/declarative/qmllanguage/data/component.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/component.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml index 07e463a..07e463a 100644 --- a/tests/auto/declarative/qmllanguage/data/component.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/component.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.2.errors.txt index 76e7656..76e7656 100644 --- a/tests/auto/declarative/qmllanguage/data/component.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/component.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml index 88e0f73..88e0f73 100644 --- a/tests/auto/declarative/qmllanguage/data/component.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/component.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt index 9a13142..9a13142 100644 --- a/tests/auto/declarative/qmllanguage/data/component.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/component.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml index 287a959..287a959 100644 --- a/tests/auto/declarative/qmllanguage/data/component.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/component.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.4.errors.txt index 2ab18685..2ab18685 100644 --- a/tests/auto/declarative/qmllanguage/data/component.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/component.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml index ab1e29b..ab1e29b 100644 --- a/tests/auto/declarative/qmllanguage/data/component.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.4.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/component.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.5.errors.txt new file mode 100644 index 0000000..e3c2df7 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.5.errors.txt @@ -0,0 +1 @@ +4:5:Component elements may not contain properties other than id diff --git a/tests/auto/declarative/qmllanguage/data/component.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml index 629e998..629e998 100644 --- a/tests/auto/declarative/qmllanguage/data/component.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/component.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/component.6.errors.txt index 2b1c6ca..2b1c6ca 100644 --- a/tests/auto/declarative/qmllanguage/data/component.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/component.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml index 2303ebf..2303ebf 100644 --- a/tests/auto/declarative/qmllanguage/data/component.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/component.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/componentCompositeType.qml b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml index 0a7249a..0a7249a 100644 --- a/tests/auto/declarative/qmllanguage/data/componentCompositeType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/componentCompositeType.qml diff --git a/tests/auto/declarative/qmllanguage/data/cppnamespace.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.2.qml index e3b32ca..e3b32ca 100644 --- a/tests/auto/declarative/qmllanguage/data/cppnamespace.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/cppnamespace.qml b/tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.qml index e1daf3b..e1daf3b 100644 --- a/tests/auto/declarative/qmllanguage/data/cppnamespace.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/cppnamespace.qml diff --git a/tests/auto/declarative/qmllanguage/data/crash2.qml b/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml index a22c776..a22c776 100644 --- a/tests/auto/declarative/qmllanguage/data/crash2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/crash2.qml diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.errors.txt index 43a8bb2..43a8bb2 100644 --- a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml index 00cc0c4..00cc0c4 100644 --- a/tests/auto/declarative/qmllanguage/data/customParserIdNotAllowed.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customParserIdNotAllowed.qml diff --git a/tests/auto/declarative/qmllanguage/data/customParserTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml index cf2f272..cf2f272 100644 --- a/tests/auto/declarative/qmllanguage/data/customParserTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customParserTypes.qml diff --git a/tests/auto/declarative/qmllanguage/data/customVariantTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/customVariantTypes.qml index 0263ed2..0263ed2 100644 --- a/tests/auto/declarative/qmllanguage/data/customVariantTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/customVariantTypes.qml diff --git a/tests/auto/declarative/qmllanguage/data/declaredPropertyValues.qml b/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml index 3987a3c..3987a3c 100644 --- a/tests/auto/declarative/qmllanguage/data/declaredPropertyValues.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/declaredPropertyValues.qml diff --git a/tests/auto/declarative/qmllanguage/data/defaultGrouped.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt index 945d51b..945d51b 100644 --- a/tests/auto/declarative/qmllanguage/data/defaultGrouped.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml index 0fd1404..0fd1404 100644 --- a/tests/auto/declarative/qmllanguage/data/defaultGrouped.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultGrouped.qml diff --git a/tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml b/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml index 3651511..3651511 100644 --- a/tests/auto/declarative/qmllanguage/data/defaultPropertyListOrder.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/defaultPropertyListOrder.qml diff --git a/tests/auto/declarative/qmllanguage/data/doubleSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt index 2aea251..2aea251 100644 --- a/tests/auto/declarative/qmllanguage/data/doubleSignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.qml index fb07b9f..fb07b9f 100644 --- a/tests/auto/declarative/qmllanguage/data/doubleSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/doubleSignal.qml diff --git a/tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.errors.txt index 66241cf..66241cf 100644 --- a/tests/auto/declarative/qmllanguage/data/duplicateIDs.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/duplicateIDs.qml b/tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.qml index a993abd..a993abd 100644 --- a/tests/auto/declarative/qmllanguage/data/duplicateIDs.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/duplicateIDs.qml diff --git a/tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml index 85d1052..85d1052 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicObject.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObject.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/dynamicObjectProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml index c80a7c0..c80a7c0 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicObjectProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicObjectProperties.qml diff --git a/tests/auto/declarative/qmllanguage/data/dynamicProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml index aef3269..aef3269 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicProperties.qml diff --git a/tests/auto/declarative/qmllanguage/data/dynamicPropertiesNested.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml index 7bfab67..7bfab67 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicPropertiesNested.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicPropertiesNested.qml diff --git a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml index 2a834e8..2a834e8 100644 --- a/tests/auto/declarative/qmllanguage/data/dynamicSignalsAndSlots.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/dynamicSignalsAndSlots.qml diff --git a/tests/auto/declarative/qmllanguage/data/empty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt index d416e76..d416e76 100644 --- a/tests/auto/declarative/qmllanguage/data/empty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/empty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/empty.qml b/tests/auto/declarative/qdeclarativelanguage/data/empty.qml index e69de29..e69de29 100644 --- a/tests/auto/declarative/qmllanguage/data/empty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/empty.qml diff --git a/tests/auto/declarative/qmllanguage/data/emptySignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt index 353bbf5..353bbf5 100644 --- a/tests/auto/declarative/qmllanguage/data/emptySignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/emptySignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml index 4c5a122..4c5a122 100644 --- a/tests/auto/declarative/qmllanguage/data/emptySignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/emptySignal.qml diff --git a/tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/failingComponent.errors.txt index 0cf0ef3..0cf0ef3 100644 --- a/tests/auto/declarative/qmllanguage/data/failingComponent.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/failingComponent.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/failingComponentTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/failingComponentTest.qml index 74a6acf..74a6acf 100644 --- a/tests/auto/declarative/qmllanguage/data/failingComponentTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/failingComponentTest.qml diff --git a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.errors.txt index 3074823..3074823 100644 --- a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.qml index d971eee..d971eee 100644 --- a/tests/auto/declarative/qmllanguage/data/fakeDotProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/fakeDotProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/finalOverride.errors.txt index 49e06cb..49e06cb 100644 --- a/tests/auto/declarative/qmllanguage/data/finalOverride.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/finalOverride.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/finalOverride.qml b/tests/auto/declarative/qdeclarativelanguage/data/finalOverride.qml index a84393a..a84393a 100644 --- a/tests/auto/declarative/qmllanguage/data/finalOverride.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/finalOverride.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyNames.qml index 558c836..558c836 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyNames.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyNames.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyUse.qml index 74918e2..74918e2 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nDeclaredPropertyUse.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nDeclaredPropertyUse.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nNameSpace.qml index c0b2f94..c0b2f94 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nNameSpace.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nNameSpace.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nScript.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml index 942ed90..942ed90 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nScript.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nScript.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nStrings.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nStrings.qml index 764c926..764c926 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nStrings.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nStrings.qml diff --git a/tests/auto/declarative/qmllanguage/data/i18nType.qml b/tests/auto/declarative/qdeclarativelanguage/data/i18nType.qml index d7954ef..d7954ef 100644 --- a/tests/auto/declarative/qmllanguage/data/i18nType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/i18nType.qml diff --git a/tests/auto/declarative/qmllanguage/data/idProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml index 90c1483..90c1483 100644 --- a/tests/auto/declarative/qmllanguage/data/idProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/idProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.errors.txt index 231998d..231998d 100644 --- a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml index cd112af..cd112af 100644 --- a/tests/auto/declarative/qmllanguage/data/importNamespaceConflict.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/importNamespaceConflict.qml diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.errors.txt index c7d880e..c7d880e 100644 --- a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.qml index 23ed566..23ed566 100644 --- a/tests/auto/declarative/qmllanguage/data/importVersionMissingBuiltIn.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingBuiltIn.qml diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.errors.txt index 89e58ee..89e58ee 100644 --- a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.qml index 97ec222..97ec222 100644 --- a/tests/auto/declarative/qmllanguage/data/importVersionMissingInstalled.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/importVersionMissingInstalled.qml diff --git a/tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml b/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml index 478f06a..478f06a 100644 --- a/tests/auto/declarative/qmllanguage/data/inlineQmlComponents.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/inlineQmlComponents.qml diff --git a/tests/auto/declarative/qmllanguage/data/interfaceProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml index 70879ff..70879ff 100644 --- a/tests/auto/declarative/qmllanguage/data/interfaceProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/interfaceProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/interfaceQList.qml b/tests/auto/declarative/qdeclarativelanguage/data/interfaceQList.qml index c87dfae..c87dfae 100644 --- a/tests/auto/declarative/qmllanguage/data/interfaceQList.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/interfaceQList.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.errors.txt index 492bbb4..492bbb4 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml index 324f79c..324f79c 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.errors.txt index ff2409b..ff2409b 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml index b768e9f..b768e9f 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.10.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.10.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.errors.txt index fee5050..fee5050 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml index 7b782be..7b782be 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.11.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.11.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.errors.txt index 34de769..34de769 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml index 1f47c61..1f47c61 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.errors.txt index 05161c4..05161c4 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml index 79c2981..79c2981 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.errors.txt index a208bcf..a208bcf 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml index af0be80..af0be80 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.errors.txt index 05161c4..05161c4 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml index 0546322..0546322 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.errors.txt index 6770e1f..6770e1f 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml index 108109a..108109a 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.errors.txt index 6770e1f..6770e1f 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml index ccf0353..ccf0353 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.7.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.errors.txt index ff2409b..ff2409b 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml index e736379..e736379 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.8.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.errors.txt index 6770e1f..6770e1f 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml index a095229..a095229 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidAttachedProperty.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidAttachedProperty.9.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.errors.txt index 810fd31..810fd31 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml index 1167e39..1167e39 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.errors.txt index 810fd31..810fd31 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml index a0c8306..a0c8306 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.errors.txt index f6d6f29..f6d6f29 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.qml index 0bbfc4f..0bbfc4f 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.errors.txt index 69c6871..69c6871 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.qml index 134fef9..134fef9 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.errors.txt index 2c8a970..2c8a970 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.qml index 55cefe6..55cefe6 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt index 8331725..8331725 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.qml index 9ec33ab..9ec33ab 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.errors.txt index 4a7e383..4a7e383 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.qml index 977539a..977539a 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidGroupedProperty.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidGroupedProperty.7.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt index 56e3eeb..56e3eeb 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.qml index 4fb3b29..4fb3b29 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.errors.txt index bb811cf..bb811cf 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.qml index 6684172..6684172 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt index cfe8756..cfe8756 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.qml index 86010bf..86010bf 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.errors.txt index c167de3..c167de3 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.qml index 5b92a1a..5b92a1a 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt index 160e8b5..160e8b5 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.qml index 62187d9..62187d9 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt index 1ca678c..1ca678c 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidID.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.qml index 04db3eb..04db3eb 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidID.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidID.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt index a65f5fd..a65f5fd 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidImportID.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidImportID.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml index 30d88d5..30d88d5 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidImportID.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidImportID.qml diff --git a/tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt index 4bcc948..4bcc948 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidRoot.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/invalidRoot.qml b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml index 427827c..427827c 100644 --- a/tests/auto/declarative/qmllanguage/data/invalidRoot.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/invalidRoot.qml diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml index d8a22a8..d8a22a8 100644 --- a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest.qml diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml index a0706ad..a0706ad 100644 --- a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/InstalledTest2.qml diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml index 93c7630..93c7630 100644 --- a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/PrivateType.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/PrivateType.qml diff --git a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir index eeb9a05..eeb9a05 100644 --- a/tests/auto/declarative/qmllanguage/data/lib/com/nokia/installedtest/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/data/lib/com/nokia/installedtest/qmldir diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.errors.txt index 8b40aa3..8b40aa3 100644 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.qml index e3baadb..e3baadb 100644 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt index 8c7b7e9..8c7b7e9 100644 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/listAssignment.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.qml index 00c4c6b..00c4c6b 100644 --- a/tests/auto/declarative/qmllanguage/data/listAssignment.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listAssignment.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml b/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml index 32b5b6c..32b5b6c 100644 --- a/tests/auto/declarative/qmllanguage/data/listItemDeleteSelf.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listItemDeleteSelf.qml diff --git a/tests/auto/declarative/qmllanguage/data/listProperties.qml b/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml index ba9e37c..ba9e37c 100644 --- a/tests/auto/declarative/qmllanguage/data/listProperties.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/listProperties.qml diff --git a/tests/auto/declarative/qmllanguage/data/missingObject.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/missingObject.errors.txt index b31b562..b31b562 100644 --- a/tests/auto/declarative/qmllanguage/data/missingObject.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingObject.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/missingObject.qml b/tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml index 2f17045..2f17045 100644 --- a/tests/auto/declarative/qmllanguage/data/missingObject.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingObject.qml diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.errors.txt index f562246..f562246 100644 --- a/tests/auto/declarative/qmllanguage/data/missingSignal.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/missingSignal.qml b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml index 3bf75f6..3bf75f6 100644 --- a/tests/auto/declarative/qmllanguage/data/missingSignal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingSignal.qml diff --git a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.errors.txt index caf7e55..caf7e55 100644 --- a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.qml index 9a0fa6a..9a0fa6a 100644 --- a/tests/auto/declarative/qmllanguage/data/missingValueTypeProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/missingValueTypeProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/nestedErrors.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt index 886da55..886da55 100644 --- a/tests/auto/declarative/qmllanguage/data/nestedErrors.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nestedErrors.qml b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml index c0d755a..c0d755a 100644 --- a/tests/auto/declarative/qmllanguage/data/nestedErrors.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nestedErrors.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.errors.txt index 6bfce9a..6bfce9a 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.qml index df7406c..df7406c 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.errors.txt index 4b30056..4b30056 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.qml index 06ccd37..06ccd37 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.errors.txt index 4b30056..4b30056 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.qml index 5b08608..5b08608 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.errors.txt index 4b30056..4b30056 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.qml index 6579191..6579191 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.errors.txt index c07f2b9..c07f2b9 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml index 37af057..37af057 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.errors.txt index 89925b7..89925b7 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.qml index 5cd55d0..5cd55d0 100644 --- a/tests/auto/declarative/qmllanguage/data/nonexistantProperty.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nonexistantProperty.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.errors.txt index 07a4094..07a4094 100644 --- a/tests/auto/declarative/qmllanguage/data/nullDotProperty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/nullDotProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.qml index 4e36779..4e36779 100644 --- a/tests/auto/declarative/qmllanguage/data/nullDotProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/nullDotProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.errors.txt index db7d9c0..db7d9c0 100644 --- a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.qml index 9924773..9924773 100644 --- a/tests/auto/declarative/qmllanguage/data/objectValueTypeProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/objectValueTypeProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/onCompleted.qml b/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml index 5725f85..5725f85 100644 --- a/tests/auto/declarative/qmllanguage/data/onCompleted.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/onCompleted.qml diff --git a/tests/auto/declarative/qmllanguage/data/property.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/property.1.errors.txt index 3ae6c46..3ae6c46 100644 --- a/tests/auto/declarative/qmllanguage/data/property.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/property.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml index cadc39a..cadc39a 100644 --- a/tests/auto/declarative/qmllanguage/data/property.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/property.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/property.2.errors.txt index a18e21a..a18e21a 100644 --- a/tests/auto/declarative/qmllanguage/data/property.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/property.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml index e810c6c..e810c6c 100644 --- a/tests/auto/declarative/qmllanguage/data/property.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/property.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/property.3.errors.txt index 5e09a25..5e09a25 100644 --- a/tests/auto/declarative/qmllanguage/data/property.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/property.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml index 04147c2..04147c2 100644 --- a/tests/auto/declarative/qmllanguage/data/property.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/property.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/property.4.errors.txt index b447186..b447186 100644 --- a/tests/auto/declarative/qmllanguage/data/property.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/property.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml index b2ec482..b2ec482 100644 --- a/tests/auto/declarative/qmllanguage/data/property.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/property.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/property.5.errors.txt index 32a8dc1..32a8dc1 100644 --- a/tests/auto/declarative/qmllanguage/data/property.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/property.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml index 65fafbb..65fafbb 100644 --- a/tests/auto/declarative/qmllanguage/data/property.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/property.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml index 57a6070..57a6070 100644 --- a/tests/auto/declarative/qmllanguage/data/propertyValueSource.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/propertyValueSource.qml b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml index ad71fcf..ad71fcf 100644 --- a/tests/auto/declarative/qmllanguage/data/propertyValueSource.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/propertyValueSource.qml diff --git a/tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml index 429c327..429c327 100644 --- a/tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml index 0f57b61..0f57b61 100644 --- a/tests/auto/declarative/qmllanguage/data/qmlAttachedPropertiesObjectMethod.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/qmlAttachedPropertiesObjectMethod.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.errors.txt index b8c3404..b8c3404 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.qml index 60757bd..60757bd 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.errors.txt index d857a04..d857a04 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.qml index 8f1633c..8f1633c 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.errors.txt index c7e9e1b..c7e9e1b 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/readOnly.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml index cd86a48..cd86a48 100644 --- a/tests/auto/declarative/qmllanguage/data/readOnly.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/readOnly.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml b/tests/auto/declarative/qdeclarativelanguage/data/rootAsQmlComponent.qml index 8d72cd3..8d72cd3 100644 --- a/tests/auto/declarative/qmllanguage/data/rootAsQmlComponent.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/rootAsQmlComponent.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt index 50518cc..50518cc 100644 --- a/tests/auto/declarative/qmllanguage/data/script.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.1.qml index 8dac8b7..8dac8b7 100644 --- a/tests/auto/declarative/qmllanguage/data/script.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.1.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt new file mode 100644 index 0000000..13f47d1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.10.errors.txt @@ -0,0 +1 @@ +6:9:Component elements may not contain script blocks diff --git a/tests/auto/declarative/qmllanguage/data/script.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.10.qml index 516e878..516e878 100644 --- a/tests/auto/declarative/qmllanguage/data/script.10.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.10.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.11.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt index a664203..a664203 100644 --- a/tests/auto/declarative/qmllanguage/data/script.11.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.11.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.11.qml index 6d2d598..6d2d598 100644 --- a/tests/auto/declarative/qmllanguage/data/script.11.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.11.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt new file mode 100644 index 0000000..f8297f5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.12.errors.txt @@ -0,0 +1 @@ +4:5:JavaScript declaration outside Script element diff --git a/tests/auto/declarative/qmllanguage/data/script.12.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.12.qml index 9ecb5d9..9ecb5d9 100644 --- a/tests/auto/declarative/qmllanguage/data/script.12.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.12.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt index 8fb3bbd..8fb3bbd 100644 --- a/tests/auto/declarative/qmllanguage/data/script.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.2.qml index dce1a41..dce1a41 100644 --- a/tests/auto/declarative/qmllanguage/data/script.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt index 8fb3bbd..8fb3bbd 100644 --- a/tests/auto/declarative/qmllanguage/data/script.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.3.qml index 8621a9a..8621a9a 100644 --- a/tests/auto/declarative/qmllanguage/data/script.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt index 49a507f..49a507f 100644 --- a/tests/auto/declarative/qmllanguage/data/script.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.4.qml index d89817c..d89817c 100644 --- a/tests/auto/declarative/qmllanguage/data/script.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt index 49a507f..49a507f 100644 --- a/tests/auto/declarative/qmllanguage/data/script.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.5.qml index 8986b3b..8986b3b 100644 --- a/tests/auto/declarative/qmllanguage/data/script.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt index 4e53b6b..4e53b6b 100644 --- a/tests/auto/declarative/qmllanguage/data/script.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.6.qml index 07e9d78..07e9d78 100644 --- a/tests/auto/declarative/qmllanguage/data/script.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt index dc15ddf..dc15ddf 100644 --- a/tests/auto/declarative/qmllanguage/data/script.7.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.7.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.7.qml index fa905e6..fa905e6 100644 --- a/tests/auto/declarative/qmllanguage/data/script.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.7.qml diff --git a/tests/auto/declarative/qmllanguage/data/script.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt index b5bf1a8..b5bf1a8 100644 --- a/tests/auto/declarative/qmllanguage/data/script.8.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.8.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/script.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.8.qml index f600c88..f600c88 100644 --- a/tests/auto/declarative/qmllanguage/data/script.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.8.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt new file mode 100644 index 0000000..41e8d46 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.9.errors.txt @@ -0,0 +1 @@ +5:9:Component elements may not contain script blocks diff --git a/tests/auto/declarative/qmllanguage/data/script.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/script.9.qml index 79aa504..79aa504 100644 --- a/tests/auto/declarative/qmllanguage/data/script.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/script.9.qml diff --git a/tests/auto/declarative/qmllanguage/data/scriptString.qml b/tests/auto/declarative/qdeclarativelanguage/data/scriptString.qml index 40a3bbe..40a3bbe 100644 --- a/tests/auto/declarative/qmllanguage/data/scriptString.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/scriptString.qml diff --git a/tests/auto/declarative/qmllanguage/data/signal.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.errors.txt index 78d9960..78d9960 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/signal.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml index fbaf017..fbaf017 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/signal.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt index fce8928..fce8928 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/signal.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml index 5049192..5049192 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/signal.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.errors.txt index bf043ac..bf043ac 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/signal.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml index 9dd4cc7..9dd4cc7 100644 --- a/tests/auto/declarative/qmllanguage/data/signal.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/signal.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/simpleBindings.qml b/tests/auto/declarative/qdeclarativelanguage/data/simpleBindings.qml index 2fcd1a5..2fcd1a5 100644 --- a/tests/auto/declarative/qmllanguage/data/simpleBindings.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/simpleBindings.qml diff --git a/tests/auto/declarative/qmllanguage/data/simpleContainer.qml b/tests/auto/declarative/qdeclarativelanguage/data/simpleContainer.qml index c3a795f..c3a795f 100644 --- a/tests/auto/declarative/qmllanguage/data/simpleContainer.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/simpleContainer.qml diff --git a/tests/auto/declarative/qmllanguage/data/simpleObject.qml b/tests/auto/declarative/qdeclarativelanguage/data/simpleObject.qml index 30c7823..30c7823 100644 --- a/tests/auto/declarative/qmllanguage/data/simpleObject.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/simpleObject.qml diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/Test.qml b/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml index c4d5905..c4d5905 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/Test.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/subdir/Test.qml diff --git a/tests/auto/declarative/qmllanguage/data/subdir/subsubdir/SubTest.qml b/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml index c4d5905..c4d5905 100644 --- a/tests/auto/declarative/qmllanguage/data/subdir/subsubdir/SubTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/subdir/subsubdir/SubTest.qml diff --git a/tests/auto/declarative/qmllanguage/data/test.js b/tests/auto/declarative/qdeclarativelanguage/data/test.js index e69de29..e69de29 100644 --- a/tests/auto/declarative/qmllanguage/data/test.js +++ b/tests/auto/declarative/qdeclarativelanguage/data/test.js diff --git a/tests/auto/declarative/qmllanguage/data/test2.js b/tests/auto/declarative/qdeclarativelanguage/data/test2.js index e69de29..e69de29 100644 --- a/tests/auto/declarative/qmllanguage/data/test2.js +++ b/tests/auto/declarative/qdeclarativelanguage/data/test2.js diff --git a/tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.errors.txt index 347db05..347db05 100644 --- a/tests/auto/declarative/qmllanguage/data/unregisteredObject.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/unregisteredObject.qml b/tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.qml index 4969f62..4969f62 100644 --- a/tests/auto/declarative/qmllanguage/data/unregisteredObject.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/unregisteredObject.qml diff --git a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.errors.txt index 3cd626d..3cd626d 100644 --- a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml b/tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.qml index 9f19680..9f19680 100644 --- a/tests/auto/declarative/qmllanguage/data/unsupportedProperty.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/unsupportedProperty.qml diff --git a/tests/auto/declarative/qmllanguage/data/valueTypes.qml b/tests/auto/declarative/qdeclarativelanguage/data/valueTypes.qml index bf325a7..bf325a7 100644 --- a/tests/auto/declarative/qmllanguage/data/valueTypes.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/valueTypes.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.errors.txt index ba7a076..ba7a076 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.1.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.1.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.qml index 289d37f..289d37f 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.1.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.1.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.errors.txt index ae75b52..ae75b52 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.10.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.10.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.qml index 2cf0e50..2cf0e50 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.10.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.10.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.errors.txt index 23a4cda..23a4cda 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.11.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.11.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.qml index ae77ba1..ae77ba1 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.11.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.11.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.errors.txt index 3092100..3092100 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.12.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.12.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.qml index b7a366f..b7a366f 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.12.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.12.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.errors.txt index ba7a076..ba7a076 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.13.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.13.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.qml index 477aff1..477aff1 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.13.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.13.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.errors.txt index d621fdd..d621fdd 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.14.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.14.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.qml index 672d693..672d693 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.14.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.14.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.errors.txt index 44768e3..44768e3 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.15.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.15.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.qml index 633a5ba..633a5ba 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.15.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.15.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.errors.txt index 9ff9f25..9ff9f25 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.2.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.2.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.qml index 34b74f7..34b74f7 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.2.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.2.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.errors.txt index 6d971c6..6d971c6 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.3.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.3.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.qml index 384181a..384181a 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.3.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.3.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.errors.txt index ef34d0e..ef34d0e 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.4.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.4.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.qml index 0787bf5..0787bf5 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.4.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.4.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.errors.txt index cab10bd..cab10bd 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.5.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.5.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.qml index c50ae9a..c50ae9a 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.5.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.5.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt index d0a0b00..d0a0b00 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.6.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.6.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.qml index da10b78..da10b78 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.6.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.6.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.errors.txt index 614346b..614346b 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.7.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.7.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.qml index ddc3835..ddc3835 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.7.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.7.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.errors.txt index 1773c00..1773c00 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.8.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.8.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.qml index a5f6756..a5f6756 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.8.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.8.qml diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.errors.txt index 8630975..8630975 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.9.errors.txt +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.errors.txt diff --git a/tests/auto/declarative/qmllanguage/data/wrongType.9.qml b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.qml index a3db732..a3db732 100644 --- a/tests/auto/declarative/qmllanguage/data/wrongType.9.qml +++ b/tests/auto/declarative/qdeclarativelanguage/data/wrongType.9.qml diff --git a/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro new file mode 100644 index 0000000..d7c1def --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/qdeclarativelanguage.pro @@ -0,0 +1,14 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += script network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativelanguage.cpp \ + testtypes.cpp +HEADERS += testtypes.h + +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h +SOURCES += ../shared/testhttpserver.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/LocalInternal.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml index 836c20a..836c20a 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/LocalInternal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/LocalInternal.qml diff --git a/tests/auto/declarative/qmllanguage/data/subdir/Test.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml index c4d5905..c4d5905 100644 --- a/tests/auto/declarative/qmllanguage/data/subdir/Test.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/Test.qml diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestLocal.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestLocal.qml index 11443ca..11443ca 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestLocal.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestLocal.qml diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestSubDir.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestSubDir.qml index 0dfede4..0dfede4 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/TestSubDir.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/TestSubDir.qml diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/pics/blue.png b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/pics/blue.png Binary files differindex 46f815f..46f815f 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/pics/blue.png +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/pics/blue.png diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir index b32f82b..b32f82b 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/qmldir diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml index 0ea9ec6..0ea9ec6 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/SubTest.qml diff --git a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/qmldir b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir index f7016c7..f7016c7 100644 --- a/tests/auto/declarative/qmllanguage/qtest/declarative/qmllanguage/subdir/qmldir +++ b/tests/auto/declarative/qdeclarativelanguage/qtest/declarative/qmllanguage/subdir/qmldir diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp new file mode 100644 index 0000000..9ffe28a --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.cpp @@ -0,0 +1,62 @@ +/**************************************************************************** +** +** 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 registerTypes() +{ + QML_REGISTER_INTERFACE(MyInterface); + QML_REGISTER_TYPE(Test,1,0,MyQmlObject,MyQmlObject); + QML_REGISTER_TYPE(Test,1,0,MyTypeObject,MyTypeObject); + QML_REGISTER_TYPE(Test,1,0,MyContainer,MyContainer); + QML_REGISTER_TYPE(Test,1,0,MyPropertyValueSource,MyPropertyValueSource); + QML_REGISTER_TYPE(Test,1,0,MyDotPropertyObject,MyDotPropertyObject); + QML_REGISTER_TYPE(Test,1,0,MyNamespacedType,MyNamespace::MyNamespacedType); + QML_REGISTER_TYPE(Test,1,0,MySecondNamespacedType,MyNamespace::MySecondNamespacedType); + QML_REGISTER_NOCREATE_TYPE(MyGroupedObject); +} + +QVariant myCustomVariantTypeConverter(const QString &data) +{ + MyCustomVariantType rv; + rv.a = data.toInt(); + return QVariant::fromValue(rv); +} + diff --git a/tests/auto/declarative/qdeclarativelanguage/testtypes.h b/tests/auto/declarative/qdeclarativelanguage/testtypes.h new file mode 100644 index 0000000..8ac7aa6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/testtypes.h @@ -0,0 +1,554 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <QtCore/qobject.h> +#include <QtCore/qrect.h> +#include <QtCore/qdatetime.h> +#include <QtGui/qmatrix.h> +#include <QtGui/qcolor.h> +#include <QtGui/qvector3d.h> +#include <QtDeclarative/qdeclarative.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeparserstatus.h> +#include <QtDeclarative/qdeclarativepropertyvaluesource.h> +#include <QtDeclarative/qdeclarativescriptstring.h> +#include <QtDeclarative/qdeclarativeproperty.h> + +QVariant myCustomVariantTypeConverter(const QString &data); + +class MyInterface +{ +public: + MyInterface() : id(913) {} + int id; +}; +Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface"); +QML_DECLARE_INTERFACE(MyInterface); + +struct MyCustomVariantType +{ + MyCustomVariantType() : a(0) {} + int a; +}; +Q_DECLARE_METATYPE(MyCustomVariantType); + +class MyAttachedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + 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; } + + int value2() const { return m_value2; } + void setValue2(int v) { m_value2 = v; } + +private: + int m_value; + int m_value2; +}; + +class MyQmlObject : public QObject, public MyInterface, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue FINAL) + Q_PROPERTY(QString readOnlyString READ readOnlyString) + Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) + Q_PROPERTY(QRect rect READ rect WRITE setRect) + Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML + Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface) + Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal); + Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType); + Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) + Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) + + Q_INTERFACES(MyInterface QDeclarativeParserStatus) +public: + MyQmlObject() : m_value(-1), m_interface(0), m_qmlobject(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); } + + int value() const { return m_value; } + void setValue(int v) { m_value = v; } + + QString readOnlyString() const { return QLatin1String(""); } + + bool enabled() const { return false; } + void setEnabled(bool) {} + + QRect rect() const { return QRect(); } + void setRect(const QRect&) {} + + QMatrix matrix() const { return QMatrix(); } + void setMatrix(const QMatrix&) {} + + MyInterface *interface() const { return m_interface; } + void setInterface(MyInterface *iface) { m_interface = iface; } + + static MyAttachedObject *qmlAttachedProperties(QObject *other) { + return new MyAttachedObject(other); + } + Q_CLASSINFO("DefaultMethod", "basicSlot()"); + + int onLiteralSignal() const { return m_value; } + void setOnLiteralSignal(int v) { m_value = v; } + + MyQmlObject *qmlobject() const { return m_qmlobject; } + void setQmlobject(MyQmlObject *o) { m_qmlobject = o; } + + MyCustomVariantType customType() const { return m_custom; } + void setCustomType(const MyCustomVariantType &v) { m_custom = v; } + + int propertyWithNotify() const { return m_propertyWithNotify; } + void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } +public slots: + void basicSlot() { qWarning("MyQmlObject::basicSlot"); } + void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } + +signals: + void basicSignal(); + void basicParameterizedSignal(int parameter); + void oddlyNamedNotifySignal(); + +private: + friend class tst_qdeclarativelanguage; + int m_value; + MyInterface *m_interface; + MyQmlObject *m_qmlobject; + MyCustomVariantType m_custom; + int m_propertyWithNotify; +}; +QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) +QML_DECLARE_TYPE(MyQmlObject); + +class MyGroupedObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeScriptString script READ script WRITE setScript); +public: + QDeclarativeScriptString script() const { return m_script; } + void setScript(const QDeclarativeScriptString &s) { m_script = s; } + +private: + QDeclarativeScriptString m_script; +}; + +QML_DECLARE_TYPE(MyGroupedObject); + + +class MyTypeObject : public QObject +{ + Q_OBJECT + Q_ENUMS(MyEnum) + Q_FLAGS(MyFlags) + + Q_PROPERTY(QString id READ id WRITE setId); + Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); + Q_PROPERTY(QDeclarativeComponent *componentProperty READ componentProperty WRITE setComponentProperty); + Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); + Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); + Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); + Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); + Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); + Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); + Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); + Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); + Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); + Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); + Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); + Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); + Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); + Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); + Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); + Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); + Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); + Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); + Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); + Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); + Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); + Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); + Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); + + Q_PROPERTY(QDeclarativeScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); + Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT); + Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT); + +public: + MyTypeObject() + : objectPropertyValue(0), componentPropertyValue(0) {} + + QString idValue; + QString id() const { + return idValue; + } + void setId(const QString &v) { + idValue = v; + } + + QObject *objectPropertyValue; + QObject *objectProperty() const { + return objectPropertyValue; + } + void setObjectProperty(QObject *v) { + objectPropertyValue = v; + } + + QDeclarativeComponent *componentPropertyValue; + QDeclarativeComponent *componentProperty() const { + return componentPropertyValue; + } + void setComponentProperty(QDeclarativeComponent *v) { + componentPropertyValue = v; + } + + enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 }; + Q_DECLARE_FLAGS(MyFlags, MyFlag) + MyFlags flagPropertyValue; + MyFlags flagProperty() const { + return flagPropertyValue; + } + void setFlagProperty(MyFlags v) { + flagPropertyValue = v; + } + + enum MyEnum { EnumVal1, EnumVal2 }; + MyEnum enumPropertyValue; + MyEnum enumProperty() const { + return enumPropertyValue; + } + void setEnumProperty(MyEnum v) { + enumPropertyValue = v; + } + + QString stringPropertyValue; + QString stringProperty() const { + return stringPropertyValue; + } + void setStringProperty(const QString &v) { + stringPropertyValue = v; + } + + uint uintPropertyValue; + uint uintProperty() const { + return uintPropertyValue; + } + void setUintProperty(const uint &v) { + uintPropertyValue = v; + } + + int intPropertyValue; + int intProperty() const { + return intPropertyValue; + } + void setIntProperty(const int &v) { + intPropertyValue = v; + } + + qreal realPropertyValue; + qreal realProperty() const { + return realPropertyValue; + } + void setRealProperty(const qreal &v) { + realPropertyValue = v; + } + + double doublePropertyValue; + double doubleProperty() const { + return doublePropertyValue; + } + void setDoubleProperty(const double &v) { + doublePropertyValue = v; + } + + float floatPropertyValue; + float floatProperty() const { + return floatPropertyValue; + } + void setFloatProperty(const float &v) { + floatPropertyValue = v; + } + + QColor colorPropertyValue; + QColor colorProperty() const { + return colorPropertyValue; + } + void setColorProperty(const QColor &v) { + colorPropertyValue = v; + } + + QDate datePropertyValue; + QDate dateProperty() const { + return datePropertyValue; + } + void setDateProperty(const QDate &v) { + datePropertyValue = v; + } + + QTime timePropertyValue; + QTime timeProperty() const { + return timePropertyValue; + } + void setTimeProperty(const QTime &v) { + timePropertyValue = v; + } + + QDateTime dateTimePropertyValue; + QDateTime dateTimeProperty() const { + return dateTimePropertyValue; + } + void setDateTimeProperty(const QDateTime &v) { + dateTimePropertyValue = v; + } + + QPoint pointPropertyValue; + QPoint pointProperty() const { + return pointPropertyValue; + } + void setPointProperty(const QPoint &v) { + pointPropertyValue = v; + } + + QPointF pointFPropertyValue; + QPointF pointFProperty() const { + return pointFPropertyValue; + } + void setPointFProperty(const QPointF &v) { + pointFPropertyValue = v; + } + + QSize sizePropertyValue; + QSize sizeProperty() const { + return sizePropertyValue; + } + void setSizeProperty(const QSize &v) { + sizePropertyValue = v; + } + + QSizeF sizeFPropertyValue; + QSizeF sizeFProperty() const { + return sizeFPropertyValue; + } + void setSizeFProperty(const QSizeF &v) { + sizeFPropertyValue = v; + } + + QRect rectPropertyValue; + QRect rectProperty() const { + return rectPropertyValue; + } + void setRectProperty(const QRect &v) { + rectPropertyValue = v; + emit rectPropertyChanged(); + } + + QRect rectPropertyValue2; + QRect rectProperty2() const { + return rectPropertyValue2; + } + void setRectProperty2(const QRect &v) { + rectPropertyValue2 = v; + } + + QRectF rectFPropertyValue; + QRectF rectFProperty() const { + return rectFPropertyValue; + } + void setRectFProperty(const QRectF &v) { + rectFPropertyValue = v; + } + + bool boolPropertyValue; + bool boolProperty() const { + return boolPropertyValue; + } + void setBoolProperty(const bool &v) { + boolPropertyValue = v; + } + + QVariant variantPropertyValue; + QVariant variantProperty() const { + return variantPropertyValue; + } + void setVariantProperty(const QVariant &v) { + variantPropertyValue = v; + } + + QVector3D vectorPropertyValue; + QVector3D vectorProperty() const { + return vectorPropertyValue; + } + void setVectorProperty(const QVector3D &v) { + vectorPropertyValue = v; + } + + QUrl urlPropertyValue; + QUrl urlProperty() const { + return urlPropertyValue; + } + void setUrlProperty(const QUrl &v) { + urlPropertyValue = v; + } + + QDeclarativeScriptString scriptPropertyValue; + QDeclarativeScriptString scriptProperty() const { + return scriptPropertyValue; + } + void setScriptProperty(const QDeclarativeScriptString &v) { + scriptPropertyValue = v; + } + + MyGroupedObject groupedValue; + MyGroupedObject *grouped() { return &groupedValue; } + + MyGroupedObject *nullGrouped() { return 0; } + + void doAction() { emit action(); } +signals: + void action(); + void rectPropertyChanged(); +}; +Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) +QML_DECLARE_TYPE(MyTypeObject); + +class MyContainer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<QObject> children READ children) + Q_PROPERTY(QDeclarativeListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) + Q_CLASSINFO("DefaultProperty", "children"); +public: + MyContainer() {} + + QDeclarativeListProperty<QObject> children() { return QDeclarativeListProperty<QObject>(this, m_children); } + QList<QObject *> *getChildren() { return &m_children; } + QDeclarativeListProperty<MyInterface> qlistInterfaces() { return QDeclarativeListProperty<MyInterface>(this, m_interfaces); } + QList<MyInterface *> *getQListInterfaces() { return &m_interfaces; } + + QList<QObject*> m_children; + QList<MyInterface *> m_interfaces; +}; + +QML_DECLARE_TYPE(MyContainer); + + +class MyPropertyValueSource : public QObject, public QDeclarativePropertyValueSource +{ + Q_OBJECT + Q_INTERFACES(QDeclarativePropertyValueSource) +public: + MyPropertyValueSource() + : QDeclarativePropertyValueSource() {} + + QDeclarativeProperty prop; + virtual void setTarget(const QDeclarativeProperty &p) + { + prop = p; + } +}; +QML_DECLARE_TYPE(MyPropertyValueSource); + +class MyDotPropertyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(MyQmlObject *obj READ obj) + Q_PROPERTY(MyQmlObject *readWriteObj READ readWriteObj WRITE setReadWriteObj) +public: + MyDotPropertyObject() : m_rwobj(0), m_ownRWObj(false) {} + ~MyDotPropertyObject() + { + if (m_ownRWObj) + delete m_rwobj; + } + + MyQmlObject *obj() { return 0; } + + MyQmlObject *readWriteObj() + { + if (!m_rwobj) { + m_rwobj = new MyQmlObject; + m_ownRWObj = true; + } + return m_rwobj; + } + + void setReadWriteObj(MyQmlObject *obj) + { + if (m_ownRWObj) { + delete m_rwobj; + m_ownRWObj = false; + } + + m_rwobj = obj; + } + +private: + MyQmlObject *m_rwobj; + bool m_ownRWObj; +}; + +QML_DECLARE_TYPE(MyDotPropertyObject); + +namespace MyNamespace { + class MyNamespacedType : public QObject + { + Q_OBJECT + }; + + class MySecondNamespacedType : public QObject + { + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<MyNamespace::MyNamespacedType> list READ list); + public: + QDeclarativeListProperty<MyNamespacedType> list() { return QDeclarativeListProperty<MyNamespacedType>(this, m_list); } + + private: + QList<MyNamespacedType *> m_list; + }; +} +QML_DECLARE_TYPE(MyNamespace::MyNamespacedType); +QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType); + +void registerTypes(); + +#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp new file mode 100644 index 0000000..1ba4454 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelanguage/tst_qdeclarativelanguage.cpp @@ -0,0 +1,1406 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtCore/qfile.h> +#include <QtCore/qdebug.h> +#include <QtCore/qfileinfo.h> +#include <QtCore/qdir.h> + +#include <private/qdeclarativeproperty_p.h> +#include <private/qdeclarativemetatype_p.h> + +#include "testtypes.h" + +#include "../../../shared/util.h" + +/* +This test case covers QML language issues. This covers everything that does not +involve evaluating ECMAScript expressions and bindings. + +Evaluation of expressions and bindings is covered in qmlecmascript +*/ +class tst_qdeclarativelanguage : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativelanguage() { + QDeclarativeMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter); + QFileInfo fileInfo(__FILE__); + engine.addImportPath(fileInfo.absoluteDir().filePath(QLatin1String("data/lib"))); + } + +private slots: + void initTestCase(); + void cleanupTestCase(); + + void errors_data(); + void errors(); + + void simpleObject(); + void simpleContainer(); + void interfaceProperty(); + void interfaceQList(); + void assignObjectToSignal(); + void assignObjectToVariant(); + void assignLiteralSignalProperty(); + void assignQmlComponent(); + void assignBasicTypes(); + void assignTypeExtremes(); + void assignCompositeToType(); + void customParserTypes(); + void rootAsQmlComponent(); + void inlineQmlComponents(); + void idProperty(); + void autoNotifyConnection(); + void assignSignal(); + void dynamicProperties(); + void dynamicPropertiesNested(); + void listProperties(); + void dynamicObjectProperties(); + void dynamicSignalsAndSlots(); + void simpleBindings(); + void autoComponentCreation(); + void propertyValueSource(); + void attachedProperties(); + void dynamicObjects(); + void customVariantTypes(); + void valueTypes(); + void cppnamespace(); + void aliasProperties(); + void componentCompositeType(); + void i18n(); + void i18n_data(); + void onCompleted(); + void scriptString(); + void defaultPropertyListOrder(); + void declaredPropertyValues(); + + void importsBuiltin_data(); + void importsBuiltin(); + void importsLocal_data(); + void importsLocal(); + void importsRemote_data(); + void importsRemote(); + void importsInstalled_data(); + void importsInstalled(); + void importsOrder_data(); + void importsOrder(); + + void qmlAttachedPropertiesObjectMethod(); + + // regression tests for crashes + void crash1(); + void crash2(); + +private: + QDeclarativeEngine engine; + void testType(const QString& qml, const QString& type); +}; + +#define VERIFY_ERRORS(errorfile) \ + if (!errorfile) { \ + if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ + qWarning() << "Unexpected Errors:" << component.errors(); \ + QVERIFY(!component.isError()); \ + QVERIFY(component.errors().isEmpty()); \ + } else { \ + QFile file(QLatin1String(SRCDIR) + QLatin1String("/data/") + QLatin1String(errorfile)); \ + QVERIFY(file.open(QIODevice::ReadOnly)); \ + QByteArray data = file.readAll(); \ + file.close(); \ + QList<QByteArray> expected = data.split('\n'); \ + expected.removeAll(QByteArray("")); \ + QList<QDeclarativeError> errors = component.errors(); \ + QList<QByteArray> actual; \ + for (int ii = 0; ii < errors.count(); ++ii) { \ + const QDeclarativeError &error = errors.at(ii); \ + QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ + QByteArray::number(error.column()) + ":" + \ + error.description().toUtf8(); \ + actual << errorStr; \ + } \ + if (qgetenv("DEBUG") != "" && expected != actual) \ + qWarning() << "Expected:" << expected << "Actual:" << actual; \ + if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ + QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ + QVERIFY(file.open(QIODevice::WriteOnly)); \ + for (int ii = 0; ii < actual.count(); ++ii) { \ + file.write(actual.at(ii)); file.write("\n"); \ + } \ + file.close(); \ + } else { \ + QCOMPARE(expected, actual); \ + } \ + } + +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} + +void tst_qdeclarativelanguage::cleanupTestCase() +{ + QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile())); +} + +void tst_qdeclarativelanguage::errors_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("errorFile"); + QTest::addColumn<bool>("create"); + + QTest::newRow("nonexistantProperty.1") << "nonexistantProperty.1.qml" << "nonexistantProperty.1.errors.txt" << false; + QTest::newRow("nonexistantProperty.2") << "nonexistantProperty.2.qml" << "nonexistantProperty.2.errors.txt" << false; + QTest::newRow("nonexistantProperty.3") << "nonexistantProperty.3.qml" << "nonexistantProperty.3.errors.txt" << false; + QTest::newRow("nonexistantProperty.4") << "nonexistantProperty.4.qml" << "nonexistantProperty.4.errors.txt" << false; + QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false; + QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false; + + QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false; + QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false; + QTest::newRow("wrongType (bad rect)") << "wrongType.3.qml" << "wrongType.3.errors.txt" << false; + + QTest::newRow("wrongType (invalid enum)") << "wrongType.4.qml" << "wrongType.4.errors.txt" << false; + QTest::newRow("wrongType (int for uint)") << "wrongType.5.qml" << "wrongType.5.errors.txt" << false; + QTest::newRow("wrongType (string for real)") << "wrongType.6.qml" << "wrongType.6.errors.txt" << false; + QTest::newRow("wrongType (int for color)") << "wrongType.7.qml" << "wrongType.7.errors.txt" << false; + QTest::newRow("wrongType (int for date)") << "wrongType.8.qml" << "wrongType.8.errors.txt" << false; + QTest::newRow("wrongType (int for time)") << "wrongType.9.qml" << "wrongType.9.errors.txt" << false; + QTest::newRow("wrongType (int for datetime)") << "wrongType.10.qml" << "wrongType.10.errors.txt" << false; + QTest::newRow("wrongType (string for point)") << "wrongType.11.qml" << "wrongType.11.errors.txt" << false; + QTest::newRow("wrongType (color for size)") << "wrongType.12.qml" << "wrongType.12.errors.txt" << false; + QTest::newRow("wrongType (number string for int)") << "wrongType.13.qml" << "wrongType.13.errors.txt" << false; + QTest::newRow("wrongType (int for string)") << "wrongType.14.qml" << "wrongType.14.errors.txt" << false; + QTest::newRow("wrongType (int for url)") << "wrongType.15.qml" << "wrongType.15.errors.txt" << false; + + QTest::newRow("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false; + QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false; + QTest::newRow("readOnly.3") << "readOnly.3.qml" << "readOnly.3.errors.txt" << false; + + QTest::newRow("listAssignment.2") << "listAssignment.2.qml" << "listAssignment.2.errors.txt" << false; + QTest::newRow("listAssignment.3") << "listAssignment.3.qml" << "listAssignment.3.errors.txt" << false; + + QTest::newRow("invalidID.1") << "invalidID.qml" << "invalidID.errors.txt" << false; + QTest::newRow("invalidID.2") << "invalidID.2.qml" << "invalidID.2.errors.txt" << false; + QTest::newRow("invalidID.3") << "invalidID.3.qml" << "invalidID.3.errors.txt" << false; + 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("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false; + QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true; + QTest::newRow("fakeDotProperty") << "fakeDotProperty.qml" << "fakeDotProperty.errors.txt" << false; + QTest::newRow("duplicateIDs") << "duplicateIDs.qml" << "duplicateIDs.errors.txt" << false; + QTest::newRow("unregisteredObject") << "unregisteredObject.qml" << "unregisteredObject.errors.txt" << false; + QTest::newRow("empty") << "empty.qml" << "empty.errors.txt" << false; + QTest::newRow("missingObject") << "missingObject.qml" << "missingObject.errors.txt" << false; + QTest::newRow("failingComponent") << "failingComponentTest.qml" << "failingComponent.errors.txt" << false; + QTest::newRow("missingSignal") << "missingSignal.qml" << "missingSignal.errors.txt" << false; + QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false; + QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false; + + QTest::newRow("invalidGroupedProperty.1") << "invalidGroupedProperty.1.qml" << "invalidGroupedProperty.1.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.2") << "invalidGroupedProperty.2.qml" << "invalidGroupedProperty.2.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.3") << "invalidGroupedProperty.3.qml" << "invalidGroupedProperty.3.errors.txt" << false; + QTest::newRow("invalidGroupedProperty.4") << "invalidGroupedProperty.4.qml" << "invalidGroupedProperty.4.errors.txt" << false; + 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("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; + QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; + QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false; + QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; + + QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; + QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; + QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false; + + QTest::newRow("property.1") << "property.1.qml" << "property.1.errors.txt" << false; + QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false; + QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false; + QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false; + QTest::newRow("property.5") << "property.5.qml" << "property.5.errors.txt" << false; + + QTest::newRow("Script.1") << "script.1.qml" << "script.1.errors.txt" << false; + QTest::newRow("Script.2") << "script.2.qml" << "script.2.errors.txt" << false; + QTest::newRow("Script.3") << "script.3.qml" << "script.3.errors.txt" << false; + QTest::newRow("Script.4") << "script.4.qml" << "script.4.errors.txt" << false; + QTest::newRow("Script.5") << "script.5.qml" << "script.5.errors.txt" << false; + QTest::newRow("Script.6") << "script.6.qml" << "script.6.errors.txt" << false; + QTest::newRow("Script.7") << "script.7.qml" << "script.7.errors.txt" << false; + QTest::newRow("Script.8") << "script.8.qml" << "script.8.errors.txt" << false; + QTest::newRow("Script.9") << "script.9.qml" << "script.9.errors.txt" << false; + QTest::newRow("Script.10") << "script.10.qml" << "script.10.errors.txt" << false; + QTest::newRow("Script.11") << "script.11.qml" << "script.11.errors.txt" << false; + QTest::newRow("Script.12") << "script.12.qml" << "script.12.errors.txt" << false; + + QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; + QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; + QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false; + QTest::newRow("Component.4") << "component.4.qml" << "component.4.errors.txt" << false; + 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("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; + QTest::newRow("invalidAttachedProperty.4") << "invalidAttachedProperty.4.qml" << "invalidAttachedProperty.4.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.5") << "invalidAttachedProperty.5.qml" << "invalidAttachedProperty.5.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.6") << "invalidAttachedProperty.6.qml" << "invalidAttachedProperty.6.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.7") << "invalidAttachedProperty.7.qml" << "invalidAttachedProperty.7.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.8") << "invalidAttachedProperty.8.qml" << "invalidAttachedProperty.8.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.9") << "invalidAttachedProperty.9.qml" << "invalidAttachedProperty.9.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.10") << "invalidAttachedProperty.10.qml" << "invalidAttachedProperty.10.errors.txt" << false; + QTest::newRow("invalidAttachedProperty.11") << "invalidAttachedProperty.11.qml" << "invalidAttachedProperty.11.errors.txt" << false; + + QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false; + QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; + QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false; + QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false; + QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false; + QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false; + QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false; +} + + +void tst_qdeclarativelanguage::errors() +{ + QFETCH(QString, file); + 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) { + QObject *object = component.create(); + QVERIFY(object == 0); + } + + VERIFY_ERRORS(errorFile.toLatin1().constData()); +} + +void tst_qdeclarativelanguage::simpleObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("simpleObject.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +void tst_qdeclarativelanguage::simpleContainer() +{ + QDeclarativeComponent component(&engine, TEST_FILE("simpleContainer.qml")); + VERIFY_ERRORS(0); + MyContainer *container= qobject_cast<MyContainer*>(component.create()); + QVERIFY(container != 0); + QCOMPARE(container->getChildren()->count(),2); +} + +void tst_qdeclarativelanguage::interfaceProperty() +{ + QDeclarativeComponent component(&engine, TEST_FILE("interfaceProperty.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->interface()); + QVERIFY(object->interface()->id == 913); +} + +void tst_qdeclarativelanguage::interfaceQList() +{ + QDeclarativeComponent component(&engine, TEST_FILE("interfaceQList.qml")); + VERIFY_ERRORS(0); + MyContainer *container= qobject_cast<MyContainer*>(component.create()); + QVERIFY(container != 0); + QVERIFY(container->getQListInterfaces()->count() == 2); + for(int ii = 0; ii < 2; ++ii) + QVERIFY(container->getQListInterfaces()->at(ii)->id == 913); +} + +void tst_qdeclarativelanguage::assignObjectToSignal() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignObjectToSignal.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); + emit object->basicSignal(); +} + +void tst_qdeclarativelanguage::assignObjectToVariant() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignObjectToVariant.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVariant v = object->property("a"); + QVERIFY(v.userType() == qMetaTypeId<QObject *>()); +} + +void tst_qdeclarativelanguage::assignLiteralSignalProperty() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignLiteralSignalProperty.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->onLiteralSignal(), 10); +} + +// Test is an external component can be loaded and assigned (to a qlist) +void tst_qdeclarativelanguage::assignQmlComponent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignQmlComponent.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->getChildren()->count() == 1); + QObject *child = object->getChildren()->at(0); + QCOMPARE(child->property("x"), QVariant(10)); + QCOMPARE(child->property("y"), QVariant(11)); +} + +// Test literal assignment to all the basic types +void tst_qdeclarativelanguage::assignBasicTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignBasicTypes.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); + QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); + QCOMPARE(object->stringProperty(), QString("Hello World!")); + QCOMPARE(object->uintProperty(), uint(10)); + QCOMPARE(object->intProperty(), -19); + QCOMPARE((float)object->realProperty(), float(23.2)); + QCOMPARE((float)object->doubleProperty(), float(-19.7)); + QCOMPARE((float)object->floatProperty(), float(8.5)); + QCOMPARE(object->colorProperty(), QColor("red")); + QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); + QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); + QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); + QCOMPARE(object->pointProperty(), QPoint(99,13)); + QCOMPARE(object->pointFProperty(), QPointF((float)-10.1, (float)12.3)); + QCOMPARE(object->sizeProperty(), QSize(99, 13)); + QCOMPARE(object->sizeFProperty(), QSizeF((float)0.1, (float)0.2)); + QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); + QCOMPARE(object->rectFProperty(), QRectF((float)1000.1, (float)-10.9, (float)400, (float)90.99)); + QCOMPARE(object->boolProperty(), true); + QCOMPARE(object->variantProperty(), QVariant("Hello World!")); + QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); + QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); + QVERIFY(object->objectProperty() != 0); + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); + QVERIFY(child != 0); + QCOMPARE(child->intProperty(), 8); +} + +// Test edge case type assignments +void tst_qdeclarativelanguage::assignTypeExtremes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignTypeExtremes.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->uintProperty(), 0xEE6B2800); + QCOMPARE(object->intProperty(), -0x77359400); +} + +// Test that a composite type can assign to a property of its base type +void tst_qdeclarativelanguage::assignCompositeToType() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignCompositeToType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Tests that custom parser types can be instantiated +void tst_qdeclarativelanguage::customParserTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("customParserTypes.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->property("count") == QVariant(2)); +} + +// Tests that the root item can be a custom component +void tst_qdeclarativelanguage::rootAsQmlComponent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("rootAsQmlComponent.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->property("x"), QVariant(11)); + QCOMPARE(object->getChildren()->count(), 2); +} + +// Tests that components can be specified inline +void tst_qdeclarativelanguage::inlineQmlComponents() +{ + QDeclarativeComponent component(&engine, TEST_FILE("inlineQmlComponents.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->getChildren()->count(), 1); + QDeclarativeComponent *comp = qobject_cast<QDeclarativeComponent *>(object->getChildren()->at(0)); + QVERIFY(comp != 0); + MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); + QVERIFY(compObject != 0); + QCOMPARE(compObject->value(), 11); +} + +// Tests that types that have an id property have it set +void tst_qdeclarativelanguage::idProperty() +{ + QDeclarativeComponent component(&engine, TEST_FILE("idProperty.qml")); + VERIFY_ERRORS(0); + MyContainer *object = qobject_cast<MyContainer *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->getChildren()->count(), 1); + MyTypeObject *child = + qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); + QVERIFY(child != 0); + QCOMPARE(child->id(), QString("myObjectId")); + QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); +} + +// Tests automatic connection to notify signals if "onBlahChanged" syntax is used +// even if the notify signal for "blah" is not called "blahChanged" +void tst_qdeclarativelanguage::autoNotifyConnection() +{ + QDeclarativeComponent component(&engine, TEST_FILE("autoNotifyConnection.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QMetaProperty prop = object->metaObject()->property(object->metaObject()->indexOfProperty("receivedNotify")); + QVERIFY(prop.isValid()); + + QCOMPARE(prop.read(object), QVariant::fromValue(false)); + object->setPropertyWithNotify(1); + QCOMPARE(prop.read(object), QVariant::fromValue(true)); +} + +// Tests that signals can be assigned to +void tst_qdeclarativelanguage::assignSignal() +{ + QDeclarativeComponent component(&engine, TEST_FILE("assignSignal.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); + QVERIFY(object != 0); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); + emit object->basicSignal(); + QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); + emit object->basicParameterizedSignal(9); +} + +// Tests the creation and assignment of dynamic properties +void tst_qdeclarativelanguage::dynamicProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dynamicProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("intProperty"), QVariant(10)); + QCOMPARE(object->property("boolProperty"), QVariant(false)); + QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); + QCOMPARE(object->property("realProperty"), QVariant((qreal)-19.9)); + QCOMPARE(object->property("stringProperty"), QVariant("Hello World!")); + QCOMPARE(object->property("urlProperty"), QVariant(TEST_FILE("main.qml"))); + QCOMPARE(object->property("colorProperty"), QVariant(QColor("red"))); + QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2))); + QCOMPARE(object->property("varProperty"), QVariant("Hello World!")); + QCOMPARE(object->property("variantProperty"), QVariant(12)); +} + +// Test that nested types can use dynamic properties +void tst_qdeclarativelanguage::dynamicPropertiesNested() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dynamicPropertiesNested.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("super_a").toInt(), 11); // Overridden + QCOMPARE(object->property("super_c").toInt(), 14); // Inherited + QCOMPARE(object->property("a").toInt(), 13); // New + QCOMPARE(object->property("b").toInt(), 12); // New + + delete object; +} + +// Tests the creation and assignment to dynamic list properties +void tst_qdeclarativelanguage::listProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("listProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toInt(), 2); +} + +// Tests the creation and assignment of dynamic object properties +// ### Not complete +void tst_qdeclarativelanguage::dynamicObjectProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dynamicObjectProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0)); + QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); +} + +// Tests the declaration of dynamic signals and slots +void tst_qdeclarativelanguage::dynamicSignalsAndSlots() +{ + QTest::ignoreMessage(QtDebugMsg, "1921"); + + QDeclarativeComponent component(&engine, TEST_FILE("dynamicSignalsAndSlots.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1); + QVERIFY(object->metaObject()->indexOfMethod("slot2()") != -1); + + QCOMPARE(object->property("test").toInt(), 0); + QMetaObject::invokeMethod(object, "slot3", Qt::DirectConnection, Q_ARG(QVariant, QVariant(10))); + QCOMPARE(object->property("test").toInt(), 10); +} + +void tst_qdeclarativelanguage::simpleBindings() +{ + QDeclarativeComponent component(&engine, TEST_FILE("simpleBindings.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value1"), QVariant(10)); + QCOMPARE(object->property("value2"), QVariant(10)); + QCOMPARE(object->property("value3"), QVariant(21)); + QCOMPARE(object->property("value4"), QVariant(10)); + QCOMPARE(object->property("objectProperty"), QVariant::fromValue(object)); +} + +void tst_qdeclarativelanguage::autoComponentCreation() +{ + QDeclarativeComponent component(&engine, TEST_FILE("autoComponentCreation.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->componentProperty() != 0); + MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); + QVERIFY(child != 0); + QCOMPARE(child->realProperty(), qreal(9)); +} + +void tst_qdeclarativelanguage::propertyValueSource() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("propertyValueSource.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QList<QObject *> valueSources; + QObjectList allChildren = object->findChildren<QObject*>(); + foreach (QObject *child, allChildren) { + if (qobject_cast<QDeclarativePropertyValueSource *>(child)) + valueSources.append(child); + } + + QCOMPARE(valueSources.count(), 1); + MyPropertyValueSource *valueSource = + qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); + QVERIFY(valueSource != 0); + QCOMPARE(valueSource->prop.object(), object); + QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("propertyValueSource.2.qml")); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QList<QObject *> valueSources; + QObjectList allChildren = object->findChildren<QObject*>(); + foreach (QObject *child, allChildren) { + if (qobject_cast<QDeclarativePropertyValueSource *>(child)) + valueSources.append(child); + } + + QCOMPARE(valueSources.count(), 1); + MyPropertyValueSource *valueSource = + qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); + QVERIFY(valueSource != 0); + QCOMPARE(valueSource->prop.object(), object); + QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); + } +} + +void tst_qdeclarativelanguage::attachedProperties() +{ + QDeclarativeComponent component(&engine, TEST_FILE("attachedProperties.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object); + QVERIFY(attached != 0); + QCOMPARE(attached->property("value"), QVariant(10)); + QCOMPARE(attached->property("value2"), QVariant(13)); +} + +// Tests non-static object properties +void tst_qdeclarativelanguage::dynamicObjects() +{ + QDeclarativeComponent component(&engine, TEST_FILE("dynamicObject.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Tests the registration of custom variant string converters +void tst_qdeclarativelanguage::customVariantTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("customVariantTypes.qml")); + VERIFY_ERRORS(0); + MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->customType().a, 10); +} + +void tst_qdeclarativelanguage::valueTypes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("valueTypes.qml")); + VERIFY_ERRORS(0); + + QString message = QLatin1String("QML MyTypeObject (") + component.url().toString() + + QLatin1String(":2:1) Binding loop detected for property \"rectProperty.width\""); + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + + + QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13)); + QCOMPARE(object->rectProperty2(), QRect(10, 11, 12, 13)); + QCOMPARE(object->intProperty(), 10); + object->doAction(); + QCOMPARE(object->rectProperty(), QRect(12, 11, 14, 13)); + QCOMPARE(object->rectProperty2(), QRect(12, 11, 14, 13)); + QCOMPARE(object->intProperty(), 12); + + // ### +#if 0 + QDeclarativeProperty p(object, "rectProperty.x"); + QCOMPARE(p.read(), QVariant(12)); + p.write(13); + QCOMPARE(p.read(), QVariant(13)); + + quint32 r = QDeclarativePropertyPrivate::saveValueType(p.coreIndex(), p.valueTypeCoreIndex()); + QDeclarativeProperty p2; + QDeclarativePropertyPrivate::restore(p2, r, object); + QCOMPARE(p2.read(), QVariant(13)); +#endif +} + +void tst_qdeclarativelanguage::cppnamespace() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("cppnamespace.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("cppnamespace.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; + } +} + +void tst_qdeclarativelanguage::aliasProperties() +{ + // Simple "int" alias + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + QCOMPARE(object->property("valueAlias").toInt(), 10); + object->setProperty("value", QVariant(13)); + QCOMPARE(object->property("valueAlias").toInt(), 13); + + // Write throught alias + object->setProperty("valueAlias", QVariant(19)); + QCOMPARE(object->property("valueAlias").toInt(), 19); + QCOMPARE(object->property("value").toInt(), 19); + + delete object; + } + + // Complex object alias + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + // Read through alias + MyQmlObject *v = + qvariant_cast<MyQmlObject *>(object->property("aliasObject")); + QVERIFY(v != 0); + QCOMPARE(v->value(), 10); + + // Write through alias + MyQmlObject *v2 = new MyQmlObject(); + v2->setParent(object); + object->setProperty("aliasObject", qVariantFromValue(v2)); + MyQmlObject *v3 = + qvariant_cast<MyQmlObject *>(object->property("aliasObject")); + QVERIFY(v3 != 0); + QCOMPARE(v3, v2); + + delete object; + } + + // Nested aliases + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.3.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 1892); + QCOMPARE(object->property("value2").toInt(), 1892); + + object->setProperty("value", QVariant(1313)); + QCOMPARE(object->property("value").toInt(), 1313); + QCOMPARE(object->property("value2").toInt(), 1313); + + object->setProperty("value2", QVariant(8080)); + QCOMPARE(object->property("value").toInt(), 8080); + QCOMPARE(object->property("value2").toInt(), 8080); + + delete object; + } + + // Enum aliases + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.4.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("enumAlias").toInt(), 1); + + delete object; + } + + // Id aliases + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.5.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVariant v = object->property("otherAlias"); + QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); + MyQmlObject *o = qvariant_cast<MyQmlObject*>(v); + QCOMPARE(o->value(), 10); + + delete o; + + v = object->property("otherAlias"); + QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); + o = qvariant_cast<MyQmlObject*>(v); + QVERIFY(o == 0); + + delete object; + } + + // Nested aliases - this used to cause a crash + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.6.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("a").toInt(), 1923); + } + + // Ptr Alias Cleanup - check that aliases to ptr types return 0 + // if the object aliased to is removed + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.7.qml")); + VERIFY_ERRORS(0); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QObject *object1 = qvariant_cast<QObject *>(object->property("object")); + QVERIFY(object1 != 0); + QObject *object2 = qvariant_cast<QObject *>(object1->property("object")); + QVERIFY(object2 != 0); + + QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject")); + QVERIFY(alias == object2); + + delete object1; + + QObject *alias2 = object; // "Random" start value + int status = -1; + void *a[] = { &alias2, 0, &status }; + QMetaObject::metacall(object, QMetaObject::ReadProperty, + object->metaObject()->indexOfProperty("aliasedObject"), a); + QVERIFY(alias2 == 0); + } + + // Simple composite type + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.8.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 10); + + delete object; + } + + // Complex composite type + { + QDeclarativeComponent component(&engine, TEST_FILE("alias.9.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 10); + + delete object; + } +} + +// Test that the root element in a composite type can be a Component +void tst_qdeclarativelanguage::componentCompositeType() +{ + QDeclarativeComponent component(&engine, TEST_FILE("componentCompositeType.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +class TestType : public QObject { + Q_OBJECT +public: + TestType(QObject *p=0) : QObject(p) {} +}; + +class TestType2 : public QObject { + Q_OBJECT +public: + TestType2(QObject *p=0) : QObject(p) {} +}; + +void tst_qdeclarativelanguage::i18n_data() +{ + QTest::addColumn<QString>("file"); + QTest::addColumn<QString>("stringProperty"); + QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245 (5 accented 'a' letters)"); + QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 10"); + QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15"); + QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20"); + QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30"); + QTest::newRow("i18nNameSpace") << "i18nNameSpace.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 40"); +} + +void tst_qdeclarativelanguage::i18n() +{ + QFETCH(QString, file); + QFETCH(QString, stringProperty); + QDeclarativeComponent component(&engine, TEST_FILE(file)); + VERIFY_ERRORS(0); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->stringProperty(), stringProperty); + + delete object; +} + +// Check that the Component::onCompleted attached property works +void tst_qdeclarativelanguage::onCompleted() +{ + QDeclarativeComponent component(&engine, TEST_FILE("onCompleted.qml")); + VERIFY_ERRORS(0); + QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); + QTest::ignoreMessage(QtDebugMsg, "Completed 10 11"); + QObject *object = component.create(); + QVERIFY(object != 0); +} + +// Check that assignments to QDeclarativeScriptString properties work +void tst_qdeclarativelanguage::scriptString() +{ + QDeclarativeComponent component(&engine, TEST_FILE("scriptString.qml")); + VERIFY_ERRORS(0); + + MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); + QVERIFY(object != 0); + QCOMPARE(object->scriptProperty().script(), QString("foo + bar")); + QCOMPARE(object->scriptProperty().scopeObject(), object); + QCOMPARE(object->scriptProperty().context(), qmlContext(object)); + + QVERIFY(object->grouped() != 0); + QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)")); + QCOMPARE(object->grouped()->script().scopeObject(), object); + QCOMPARE(object->grouped()->script().context(), qmlContext(object)); +} + +// Check that default property assignments are correctly spliced into explicit +// property assignments +void tst_qdeclarativelanguage::defaultPropertyListOrder() +{ + QDeclarativeComponent component(&engine, TEST_FILE("defaultPropertyListOrder.qml")); + VERIFY_ERRORS(0); + + MyContainer *container = qobject_cast<MyContainer *>(component.create()); + QVERIFY(container != 0); + + QCOMPARE(container->getChildren()->count(), 6); + QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); + QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1)); + QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2)); + QCOMPARE(container->getChildren()->at(3)->property("index"), QVariant(3)); + QCOMPARE(container->getChildren()->at(4)->property("index"), QVariant(4)); + QCOMPARE(container->getChildren()->at(5)->property("index"), QVariant(5)); +} + +void tst_qdeclarativelanguage::declaredPropertyValues() +{ + QDeclarativeComponent component(&engine, TEST_FILE("declaredPropertyValues.qml")); + QEXPECT_FAIL("", "QTBUG-7860", Abort); + VERIFY_ERRORS(0); +} + +// Check that first child of qml is of given type. Empty type insists on error. +void tst_qdeclarativelanguage::testType(const QString& qml, const QString& type) +{ + QDeclarativeComponent component(&engine); + component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports + + QTRY_VERIFY(!component.isLoading()); + + if (type.isEmpty()) { + QVERIFY(component.isError()); + } else { + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(QString(object->metaObject()->className()), type); + } +} + +QML_DECLARE_TYPE(TestType) +QML_DECLARE_TYPE(TestType2) + +// Import tests (QT-558) + +void tst_qdeclarativelanguage::importsBuiltin_data() +{ + // QT-610 + + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + + // import built-ins + QTest::newRow("missing import") + << "Test {}" + << ""; + QTest::newRow("not in version 0.0") + << "import com.nokia.Test 0.0\n" + "Test {}" + << ""; + QTest::newRow("in version 0.0") + << "import com.nokia.Test 0.0\n" + "TestTP {}" + << "TestType"; + QTest::newRow("qualified in version 0.0") + << "import com.nokia.Test 0.0 as T\n" + "T.TestTP {}" + << "TestType"; + QTest::newRow("in version 1.0") + << "import com.nokia.Test 1.0\n" + "Test {}" + << "TestType"; + QTest::newRow("qualified wrong") + << "import com.nokia.Test 1.0 as T\n" // QT-610 + "Test {}" + << ""; + QTest::newRow("qualified right") + << "import com.nokia.Test 1.0 as T\n" + "T.Test {}" + << "TestType"; + QTest::newRow("qualified right but not in version 0.0") + << "import com.nokia.Test 0.0 as T\n" + "T.Test {}" + << ""; + QTest::newRow("in version 1.1") + << "import com.nokia.Test 1.1\n" + "Test {}" + << "TestType"; + QTest::newRow("in version 1.3") + << "import com.nokia.Test 1.3\n" + "Test {}" + << "TestType"; + QTest::newRow("in version 1.5") + << "import com.nokia.Test 1.5\n" + "Test {}" + << "TestType"; + QTest::newRow("changed in version 1.8") + << "import com.nokia.Test 1.8\n" + "Test {}" + << "TestType2"; + QTest::newRow("in version 1.12") + << "import com.nokia.Test 1.12\n" + "Test {}" + << "TestType2"; + QTest::newRow("old in version 1.9") + << "import com.nokia.Test 1.9\n" + "OldTest {}" + << "TestType"; + QTest::newRow("old in version 1.11") + << "import com.nokia.Test 1.11\n" + "OldTest {}" + << "TestType"; + QTest::newRow("multiversion 1") + << "import com.nokia.Test 1.11\n" + "import com.nokia.Test 1.12\n" + "Test {}" + << "TestType2"; + QTest::newRow("multiversion 2") + << "import com.nokia.Test 1.11\n" + "import com.nokia.Test 1.12\n" + "OldTest {}" + << "TestType"; + QTest::newRow("qualified multiversion 3") + << "import com.nokia.Test 1.0 as T0\n" + "import com.nokia.Test 1.8 as T8\n" + "T0.Test {}" + << "TestType"; + QTest::newRow("qualified multiversion 4") + << "import com.nokia.Test 1.0 as T0\n" + "import com.nokia.Test 1.8 as T8\n" + "T8.Test {}" + << "TestType2"; +} + +void tst_qdeclarativelanguage::importsBuiltin() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + testType(qml,type); +} + +void tst_qdeclarativelanguage::importsLocal_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + + // import locals + QTest::newRow("local import") + << "import \"subdir\"\n" // QT-613 + "Test {}" + << "QDeclarativeRectangle"; + QTest::newRow("local import second") + << "import Qt 4.6\nimport \"subdir\"\n" + "Test {}" + << "QDeclarativeRectangle"; + QTest::newRow("local import subsubdir") + << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" + "SubTest {}" + << "QDeclarativeRectangle"; + QTest::newRow("local import QTBUG-7721 A") + << "subdir.Test {}" // no longer allowed (QTBUG-7721) + << ""; + QTest::newRow("local import QTBUG-7721 B") + << "import \"subdir\" as X\n" + "X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721) + << ""; + QTest::newRow("local import as") + << "import \"subdir\" as T\n" + "T.Test {}" + << "QDeclarativeRectangle"; + QTest::newRow("wrong local import as") + << "import \"subdir\" as T\n" + "Test {}" + << ""; + QTest::newRow("library precedence over local import") + << "import \"subdir\"\n" + "import com.nokia.Test 1.0\n" + "Test {}" + << "TestType"; +} + +void tst_qdeclarativelanguage::importsLocal() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + testType(qml,type); +} + +void tst_qdeclarativelanguage::importsRemote_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + + QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; + + QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QDeclarativeRectangle"; + QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QDeclarativeText"; + QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QDeclarativeImage"; +} + +#include "testhttpserver.h" + +void tst_qdeclarativelanguage::importsRemote() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + + TestHTTPServer server(14445); + server.serveDirectory(SRCDIR); + + testType(qml,type); +} + +void tst_qdeclarativelanguage::importsInstalled_data() +{ + // QT-610 + + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + + // import installed + QTest::newRow("installed import 0") + << "import com.nokia.installedtest 0.0\n" + "InstalledTestTP {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import 0 as TP") + << "import com.nokia.installedtest 0.0 as TP\n" + "TP.InstalledTestTP {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import 1") + << "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import 2") + << "import com.nokia.installedtest 1.3\n" + "InstalledTest {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import 3") + << "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << "QDeclarativeText"; + QTest::newRow("installed import 4") + << "import com.nokia.installedtest 1.10\n" + "InstalledTest {}" + << "QDeclarativeText"; + QTest::newRow("installed import visibility") // QT-614 + << "import com.nokia.installedtest 1.4\n" + "PrivateType {}" + << ""; +} + +void tst_qdeclarativelanguage::importsInstalled() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + testType(qml,type); +} + + +void tst_qdeclarativelanguage::importsOrder_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("type"); + + QTest::newRow("installed import overrides 1") << + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << "QDeclarativeText"; + QTest::newRow("installed import overrides 2") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import re-overrides 1") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "InstalledTest {}" + << "QDeclarativeText"; + QTest::newRow("installed import re-overrides 2") << + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "import com.nokia.installedtest 1.4\n" + "import com.nokia.installedtest 1.0\n" + "InstalledTest {}" + << "QDeclarativeRectangle"; + + QTest::newRow("installed import versus builtin 1") << + "import com.nokia.installedtest 1.5\n" + "import Qt 4.6\n" + "Rectangle {}" + << "QDeclarativeRectangle"; + QTest::newRow("installed import versus builtin 2") << + "import Qt 4.6\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle {}" + << "QDeclarativeText"; + QTest::newRow("namespaces cannot be overridden by types 1") << + "import Qt 4.6 as Rectangle\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle {}" + << ""; + QTest::newRow("namespaces cannot be overridden by types 2") << + "import Qt 4.6 as Rectangle\n" + "import com.nokia.installedtest 1.5\n" + "Rectangle.Image {}" + << "QDeclarativeImage"; +} + +void tst_qdeclarativelanguage::importsOrder() +{ + QFETCH(QString, qml); + QFETCH(QString, type); + testType(qml,type); +} + +void tst_qdeclarativelanguage::qmlAttachedPropertiesObjectMethod() +{ + QObject object; + + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0); + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, true), (QObject *)0); + + { + QDeclarativeComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.1.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.2.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0); + QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); + } +} + +void tst_qdeclarativelanguage::crash1() +{ + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\nComponent {}", QUrl()); +} + +void tst_qdeclarativelanguage::crash2() +{ + QDeclarativeComponent component(&engine, TEST_FILE("crash2.qml")); +} + + +void tst_qdeclarativelanguage::initTestCase() +{ + registerTypes(); + + QML_REGISTER_TYPE(com.nokia.Test, 0, 0, TestTP, TestType); + QML_REGISTER_TYPE(com.nokia.Test, 1, 0, Test, TestType); + QML_REGISTER_TYPE(com.nokia.Test, 1, 5, Test, TestType); + QML_REGISTER_TYPE(com.nokia.Test, 1, 8, Test, TestType2); + QML_REGISTER_TYPE(com.nokia.Test, 1, 9, OldTest, TestType); + QML_REGISTER_TYPE(com.nokia.Test, 1, 12, Test, TestType2); + + // Create locale-specific file + // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit + // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters + // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded + QFile in(TEST_FILE(QLatin1String("I18nType30.qml")).toLocalFile()); + QVERIFY(in.open(QIODevice::ReadOnly)); + QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile()); + QVERIFY(out.open(QIODevice::WriteOnly)); + out.write(in.readAll()); +} + +QTEST_MAIN(tst_qdeclarativelanguage) + +#include "tst_qdeclarativelanguage.moc" diff --git a/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro new file mode 100644 index 0000000..d728d08 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistmodel/qdeclarativelistmodel.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += script +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativelistmodel.cpp diff --git a/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp new file mode 100644 index 0000000..a1e6d6b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistmodel/tst_qdeclarativelistmodel.cpp @@ -0,0 +1,346 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/private/qdeclarativelistmodel_p.h> +#include <QtDeclarative/private/qdeclarativeexpression_p.h> +#include <QDeclarativeComponent> +#include <QDebug> + +class tst_QDeclarativeListModel : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeListModel() {} + +private slots: + void static_types(); + void static_types_data(); + void static_i18n(); + void static_nestedElements(); + void static_nestedElements_data(); + void dynamic_data(); + void dynamic(); + void error_data(); + void error(); +}; + +void tst_QDeclarativeListModel::static_i18n() +{ + QString expect = QString::fromUtf8("na\303\257ve"); + QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); + QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create()); + QVERIFY(obj != 0); + QString prop = obj->get(0).property(QLatin1String("prop1")).toString(); + QCOMPARE(prop,expect); + delete obj; +} + +void tst_QDeclarativeListModel::static_nestedElements() +{ + QFETCH(int, elementCount); + + QStringList elements; + for (int i=0; i<elementCount; i++) + elements.append("ListElement { a: 1; b: 2 }"); + QString elementsStr = elements.join(",\n") + "\n"; + + QString componentStr = + "import Qt 4.6\n" + "ListModel {\n" + " ListElement {\n" + " attributes: [\n"; + componentStr += elementsStr.toUtf8().constData(); + componentStr += + " ]\n" + " }\n" + "}"; + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); + + QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create()); + QVERIFY(obj != 0); + + QScriptValue prop = obj->get(0).property(QLatin1String("attributes")).property(QLatin1String("count")); + QVERIFY(prop.isNumber()); + QCOMPARE(prop.toInt32(), qint32(elementCount)); + + delete obj; +} + +void tst_QDeclarativeListModel::static_nestedElements_data() +{ + QTest::addColumn<int>("elementCount"); + + QTest::newRow("0 items") << 0; + QTest::newRow("1 item") << 1; + QTest::newRow("2 items") << 2; + QTest::newRow("many items") << 5; +} + +void tst_QDeclarativeListModel::dynamic_data() +{ + QTest::addColumn<QString>("script"); + QTest::addColumn<int>("result"); + QTest::addColumn<QString>("warning"); + + // Simple flat model + + QTest::newRow("count") << "count" << 0 << ""; + + QTest::newRow("get1") << "{get(0)}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; + QTest::newRow("get2") << "{get(-1)}" << 0 << "QML ListModel (unknown location) get: index -1 out of range"; + + QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << ""; + QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << ""; + QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << ""; + QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << ""; + QTest::newRow("append4a") << "{append(123)}" << 0 << "QML ListModel (unknown location) append: value is not an object"; + QTest::newRow("append4b") << "{append([1,2,3])}" << 0 << "QML ListModel (unknown location) append: value is not an object"; + + QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << ""; + QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << ""; + QTest::newRow("clear2") << "{append({'foo':123});clear();get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; + + QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << ""; + QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << ""; + QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << ""; + QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << ""; + QTest::newRow("remove3") << "{append({'foo':123});remove(0);get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; + QTest::newRow("remove3a") << "{append({'foo':123});remove(-1)}" << 0 << "QML ListModel (unknown location) remove: index -1 out of range"; + QTest::newRow("remove4a") << "{remove(0)}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range"; + QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0)}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range"; + QTest::newRow("remove4c") << "{append({'foo':123});remove(1)}" << 0 << "QML ListModel (unknown location) remove: index 1 out of range"; + + QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << ""; + QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "QML ListModel (unknown location) insert: index 1 out of range"; + QTest::newRow("insert3a") << "{append({'foo':123});insert(1,{'foo':456});count}" << 2 << ""; + QTest::newRow("insert3b") << "{append({'foo':123});insert(1,{'foo':456});get(0).foo}" << 123 << ""; + QTest::newRow("insert3c") << "{append({'foo':123});insert(1,{'foo':456});get(1).foo}" << 456 << ""; + QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << ""; + QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << ""; + QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456})}" << 0 << "QML ListModel (unknown location) insert: index -1 out of range"; + QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "QML ListModel (unknown location) insert: value is not an object"; + QTest::newRow("insert5b") << "{insert(0,[1,2,3])}" << 0 << "QML ListModel (unknown location) insert: value is not an object"; + + QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << ""; + QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << ""; + QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << ""; + QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << ""; + QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index 0 out of range"; + QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index -1 out of range"; + QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123)}" << 0 << "QML ListModel (unknown location) set: value is not an object"; + QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3])}" << 0 << "QML ListModel (unknown location) set: value is not an object"; + QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << ""; + + QTest::newRow("setprop1") << "{append({'foo':123});setProperty(0,'foo',456);count}" << 1 << ""; + QTest::newRow("setprop2") << "{append({'foo':123});setProperty(0,'foo',456);get(0).foo}" << 456 << ""; + QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).foo}" << 999 << ""; + QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).bar}" << 456 << ""; + QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index 0 out of range"; + QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index -1 out of range"; + QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index 1 out of range"; + QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});setProperty(1,'bar',222);get(1).bar}" << 222 << ""; + + QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << ""; + QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << ""; + QTest::newRow("move1c") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(1).foo}" << 123 << ""; + QTest::newRow("move1d") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(0).foo}" << 456 << ""; + QTest::newRow("move1e") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(1).foo}" << 123 << ""; + QTest::newRow("move2a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);count}" << 3 << ""; + QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << ""; + QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << ""; + QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << ""; + QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3)}" << 0 << "QML ListModel (unknown location) move: out of range"; + QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1)}" << 0 << "QML ListModel (unknown location) move: out of range"; + QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1)}" << 0 << "QML ListModel (unknown location) move: out of range"; + QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1)}" << 0 << "QML ListModel (unknown location) move: out of range"; + + // Structured model + + QTest::newRow("listprop1a") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});count}" << 1 << ""; + QTest::newRow("listprop1b") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.get(1).a}" << 2 << ""; + QTest::newRow("listprop2a") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.append({'a':4});get(0).bars.get(3).a}" << 4 << ""; +} + +void tst_QDeclarativeListModel::dynamic() +{ + QFETCH(QString, script); + QFETCH(int, result); + QFETCH(QString, warning); + + QDeclarativeEngine engine; + QDeclarativeListModel model; + QDeclarativeEngine::setContextForObject(&model,engine.rootContext()); + engine.rootContext()->addDefaultObject(&model); + QDeclarativeExpression e(engine.rootContext(), script, &model); + if (!warning.isEmpty()) + QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); + int actual = e.value().toInt(); + if (e.hasError()) + qDebug() << e.error(); // errors not expected + QVERIFY(!e.hasError()); + QCOMPARE(actual,result); +} + +void tst_QDeclarativeListModel::static_types_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QVariant>("value"); + + QTest::newRow("string") + << "ListElement { foo: \"bar\" }" + << QVariant(QString("bar")); + + QTest::newRow("real") + << "ListElement { foo: 10.5 }" + << QVariant(10.5); + + QTest::newRow("real0") + << "ListElement { foo: 0 }" + << QVariant(double(0)); + + QTest::newRow("bool") + << "ListElement { foo: false }" + << QVariant(false); + + QTest::newRow("bool") + << "ListElement { foo: true }" + << QVariant(true); + + QTest::newRow("enum") + << "ListElement { foo: Text.AlignHCenter }" + << QVariant("QTBUG-5974:ListElement: constant script support for property value"); +} + +void tst_QDeclarativeListModel::static_types() +{ + QFETCH(QString, qml); + QFETCH(QVariant, value); + + qml = "import Qt 4.6\nListModel { " + qml + " }"; + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); + + if (value.toString().startsWith("QTBUG-")) + QEXPECT_FAIL("",value.toString().toLatin1(),Abort); + + QVERIFY(!component.isError()); + + QDeclarativeListModel *obj = qobject_cast<QDeclarativeListModel*>(component.create()); + QVERIFY(obj != 0); + + QScriptValue actual = obj->get(0).property(QLatin1String("foo")); + + QCOMPARE(actual.isString(), value.type() == QVariant::String); + QCOMPARE(actual.isBoolean(), value.type() == QVariant::Bool); + QCOMPARE(actual.isNumber(), value.type() == QVariant::Double); + + QCOMPARE(actual.toString(), value.toString()); + + delete obj; +} + +void tst_QDeclarativeListModel::error_data() +{ + QTest::addColumn<QString>("qml"); + QTest::addColumn<QString>("error"); + + QTest::newRow("id not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { id: fred } }" + << "ListElement: cannot use reserved \"id\" property"; + + QTest::newRow("id allowed in ListModel") + << "import Qt 4.6\nListModel { id:model }" + << ""; + + QTest::newRow("random properties not allowed in ListModel") + << "import Qt 4.6\nListModel { foo:123 }" + << "ListModel: undefined property 'foo'"; + + QTest::newRow("random properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo:123 } }" + << ""; + + QTest::newRow("bindings not allowed in ListElement") + << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" + << "ListElement: cannot use script for property value"; // but note QTBUG-5974 + + QTest::newRow("random object list properties allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" + << ""; + + QTest::newRow("default properties not allowed in ListElement") + << "import Qt 4.6\nListModel { ListElement { Item { } } }" + << "QTBUG-6082 ListElement should not allow child objects"; +} + +void tst_QDeclarativeListModel::error() +{ + QFETCH(QString, qml); + QFETCH(QString, error); + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(qml.toUtf8(), + QUrl::fromLocalFile(QString("dummy.qml"))); + if (error.isEmpty()) { + QVERIFY(!component.isError()); + } else { + if (error.startsWith(QLatin1String("QTBUG-"))) + QEXPECT_FAIL("",error.toLatin1(),Abort); + QVERIFY(component.isError()); + QList<QDeclarativeError> errors = component.errors(); + QCOMPARE(errors.count(),1); + QCOMPARE(errors.at(0).description(),error); + } +} + +QTEST_MAIN(tst_QDeclarativeListModel) + +#include "tst_qdeclarativelistmodel.moc" diff --git a/tests/auto/declarative/qmllist/data/MyType.qml b/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml index d08f35b..d08f35b 100644 --- a/tests/auto/declarative/qmllist/data/MyType.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/MyType.qml diff --git a/tests/auto/declarative/qmllist/data/engineTypes.qml b/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml index 670aee4..670aee4 100644 --- a/tests/auto/declarative/qmllist/data/engineTypes.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/engineTypes.qml diff --git a/tests/auto/declarative/qmllist/data/variantToList.qml b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml index 0c2d0aa..0c2d0aa 100644 --- a/tests/auto/declarative/qmllist/data/variantToList.qml +++ b/tests/auto/declarative/qdeclarativelistreference/data/variantToList.qml diff --git a/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro new file mode 100644 index 0000000..0c9b2d9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistreference/qdeclarativelistreference.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativelistreference.cpp diff --git a/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp new file mode 100644 index 0000000..1b7af19 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistreference/tst_qdeclarativelistreference.cpp @@ -0,0 +1,580 @@ +/**************************************************************************** +** +** 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 <QUrl> +#include <QFileInfo> +#include <QDir> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QtDeclarative/qdeclarative.h> +#include <QtDeclarative/qdeclarativeprivate.h> +#include <QtDeclarative/qdeclarativeproperty.h> +#include <QDebug> + +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); +} + +inline QUrl TEST_FILE(const char *filename) +{ + return TEST_FILE(QLatin1String(filename)); +} + +class tst_qdeclarativelistreference : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativelistreference() {} + +private slots: + void initTestCase(); + void qmllistreference(); + void qmllistreference_invalid(); + void isValid(); + void object(); + void listElementType(); + void canAppend(); + void canAt(); + void canClear(); + void canCount(); + void append(); + void at(); + void clear(); + void count(); + void copy(); + void qmlmetaproperty(); + void engineTypes(); + void variantToList(); +}; + +class TestType : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<TestType> data READ dataProperty); + Q_PROPERTY(int intProperty READ intProperty); + +public: + TestType() : property(this, data) {} + QDeclarativeListProperty<TestType> dataProperty() { return property; } + int intProperty() const { return 10; } + + QList<TestType *> data; + QDeclarativeListProperty<TestType> property; +}; +QML_DECLARE_TYPE(TestType); + +void tst_qdeclarativelistreference::initTestCase() +{ + QML_REGISTER_NOCREATE_TYPE(TestType); +} + +void tst_qdeclarativelistreference::qmllistreference() +{ + TestType tt; + + QDeclarativeListReference r(&tt, "data"); + QVERIFY(r.isValid() == true); + QCOMPARE(r.count(), 0); + + tt.data.append(&tt); + QCOMPARE(r.count(), 1); +} + +void tst_qdeclarativelistreference::qmllistreference_invalid() +{ + TestType tt; + + // Invalid + { + QDeclarativeListReference r; + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } + + // Non-property + { + QDeclarativeListReference r(&tt, "blah"); + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } + + // Non-list property + { + QDeclarativeListReference r(&tt, "intProperty"); + QVERIFY(r.isValid() == false); + QVERIFY(r.object() == 0); + QVERIFY(r.listElementType() == 0); + QVERIFY(r.canAt() == false); + QVERIFY(r.canClear() == false); + QVERIFY(r.canCount() == false); + QVERIFY(r.append(0) == false); + QVERIFY(r.at(10) == 0); + QVERIFY(r.clear() == false); + QVERIFY(r.count() == 0); + } +} + +void tst_qdeclarativelistreference::isValid() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.isValid() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.isValid() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.isValid() == true); + delete tt; + QVERIFY(ref.isValid() == false); + } +} + +void tst_qdeclarativelistreference::object() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.object() == 0); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.object() == 0); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.object() == tt); + delete tt; + QVERIFY(ref.object() == 0); + } +} + +void tst_qdeclarativelistreference::listElementType() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.listElementType() == 0); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.listElementType() == 0); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.listElementType() == &TestType::staticMetaObject); + delete tt; + QVERIFY(ref.listElementType() == 0); + } +} + +void tst_qdeclarativelistreference::canAppend() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.canAppend() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.canAppend() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.canAppend() == true); + delete tt; + QVERIFY(ref.canAppend() == false); + } + + { + TestType tt; + tt.property.append = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.canAppend() == false); + } +} + +void tst_qdeclarativelistreference::canAt() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.canAt() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.canAt() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.canAt() == true); + delete tt; + QVERIFY(ref.canAt() == false); + } + + { + TestType tt; + tt.property.at = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.canAt() == false); + } +} + +void tst_qdeclarativelistreference::canClear() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.canClear() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.canClear() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.canClear() == true); + delete tt; + QVERIFY(ref.canClear() == false); + } + + { + TestType tt; + tt.property.clear = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.canClear() == false); + } +} + +void tst_qdeclarativelistreference::canCount() +{ + TestType *tt = new TestType; + + { + QDeclarativeListReference ref; + QVERIFY(ref.canCount() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.canCount() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.canCount() == true); + delete tt; + QVERIFY(ref.canCount() == false); + } + + { + TestType tt; + tt.property.count = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.canCount() == false); + } +} + +void tst_qdeclarativelistreference::append() +{ + TestType *tt = new TestType; + QObject object; + + { + QDeclarativeListReference ref; + QVERIFY(ref.append(tt) == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.append(tt) == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.append(tt) == true); + QVERIFY(tt->data.count() == 1); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(ref.append(&object) == false); + QVERIFY(tt->data.count() == 1); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(ref.append(0) == true); + QVERIFY(tt->data.count() == 2); + QVERIFY(tt->data.at(0) == tt); + QVERIFY(tt->data.at(1) == 0); + delete tt; + QVERIFY(ref.append(0) == false); + } + + { + TestType tt; + tt.property.append = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.append(&tt) == false); + } +} + +void tst_qdeclarativelistreference::at() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QDeclarativeListReference ref; + QVERIFY(ref.at(0) == 0); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.at(0) == 0); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.at(0) == tt); + QVERIFY(ref.at(1) == 0); + QVERIFY(ref.at(2) == tt); + delete tt; + QVERIFY(ref.at(0) == 0); + } + + { + TestType tt; + tt.data.append(&tt); + tt.property.at = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.at(0) == 0); + } +} + +void tst_qdeclarativelistreference::clear() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QDeclarativeListReference ref; + QVERIFY(ref.clear() == false); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.clear() == false); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.clear() == true); + QVERIFY(tt->data.count() == 0); + delete tt; + QVERIFY(ref.clear() == false); + } + + { + TestType tt; + tt.property.clear = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.clear() == false); + } +} + +void tst_qdeclarativelistreference::count() +{ + TestType *tt = new TestType; + tt->data.append(tt); + tt->data.append(0); + tt->data.append(tt); + + { + QDeclarativeListReference ref; + QVERIFY(ref.count() == 0); + } + + { + QDeclarativeListReference ref(tt, "blah"); + QVERIFY(ref.count() == 0); + } + + { + QDeclarativeListReference ref(tt, "data"); + QVERIFY(ref.count() == 3); + tt->data.removeAt(1); + QVERIFY(ref.count() == 2); + delete tt; + QVERIFY(ref.count() == 0); + } + + { + TestType tt; + tt.data.append(&tt); + tt.property.count = 0; + QDeclarativeListReference ref(&tt, "data"); + QVERIFY(ref.count() == 0); + } +} + +void tst_qdeclarativelistreference::copy() +{ + TestType tt; + tt.data.append(&tt); + tt.data.append(0); + tt.data.append(&tt); + + QDeclarativeListReference *r1 = new QDeclarativeListReference(&tt, "data"); + QVERIFY(r1->count() == 3); + + QDeclarativeListReference r2(*r1); + QDeclarativeListReference r3; + r3 = *r1; + + QVERIFY(r2.count() == 3); + QVERIFY(r3.count() == 3); + + delete r1; + + QVERIFY(r2.count() == 3); + QVERIFY(r3.count() == 3); + + tt.data.removeAt(2); + + QVERIFY(r2.count() == 2); + QVERIFY(r3.count() == 2); +} + +void tst_qdeclarativelistreference::qmlmetaproperty() +{ + TestType tt; + tt.data.append(&tt); + tt.data.append(0); + tt.data.append(&tt); + + QDeclarativeProperty prop(&tt, QLatin1String("data")); + QVariant v = prop.read(); + QVERIFY(v.userType() == qMetaTypeId<QDeclarativeListReference>()); + QDeclarativeListReference ref = qvariant_cast<QDeclarativeListReference>(v); + QVERIFY(ref.count() == 3); + QVERIFY(ref.listElementType() == &TestType::staticMetaObject); +} + +void tst_qdeclarativelistreference::engineTypes() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("engineTypes.qml")); + + QObject *o = component.create(); + QVERIFY(o); + + QDeclarativeProperty p1(o, QLatin1String("myList")); + QVERIFY(p1.propertyTypeCategory() == QDeclarativeProperty::Normal); + + QDeclarativeProperty p2(o, QLatin1String("myList"), engine.rootContext()); + QVERIFY(p2.propertyTypeCategory() == QDeclarativeProperty::List); + QVariant v = p2.read(); + QVERIFY(v.userType() == qMetaTypeId<QDeclarativeListReference>()); + QDeclarativeListReference ref = qvariant_cast<QDeclarativeListReference>(v); + QVERIFY(ref.count() == 2); + QVERIFY(ref.listElementType()); + QVERIFY(ref.listElementType() != &QObject::staticMetaObject); + + delete o; +} + +void tst_qdeclarativelistreference::variantToList() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("variantToList.qml")); + + QObject *o = component.create(); + QVERIFY(o); + + QVERIFY(o->property("value").userType() == qMetaTypeId<QDeclarativeListReference>()); + QCOMPARE(o->property("test").toInt(), 1); + + delete o; +} + +QTEST_MAIN(tst_qdeclarativelistreference) + +#include "tst_qdeclarativelistreference.moc" diff --git a/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml new file mode 100644 index 0000000..7b124a5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/displaylist.qml @@ -0,0 +1,43 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + height: 20 + width: 240 + Text { + text: index + } + Text { + x: 30 + objectName: "displayText" + text: display + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + } + }, + Component { + id: myHighlight + Rectangle { color: "green" } + } + ] + ListView { + id: list + objectName: "list" + focus: true + width: 240 + height: 320 + model: testModel + delegate: myDelegate + highlight: myHighlight + highlightMoveSpeed: 1000 + highlightResizeSpeed: 1000 + } +} diff --git a/tests/auto/declarative/qmlgraphicslistview/data/itemlist.qml b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml index e6b5c8f..e6b5c8f 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/itemlist.qml diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml index 46fddae..46fddae 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview-enforcerange.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-enforcerange.qml diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview-initCurrent.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml index 74f5ef4..74f5ef4 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview-initCurrent.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-initCurrent.qml diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml index 4b5bea6..4b5bea6 100644 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview-sections.qml +++ b/tests/auto/declarative/qdeclarativelistview/data/listview-sections.qml diff --git a/tests/auto/declarative/qdeclarativelistview/data/listview.qml b/tests/auto/declarative/qdeclarativelistview/data/listview.qml new file mode 100644 index 0000000..1c1b3f8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/data/listview.qml @@ -0,0 +1,119 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + function checkProperties() { + testObject.error = false; + if (list.model != testModel) { + console.log("model property incorrect"); + testObject.error = true; + } + if (!testObject.animate && list.delegate != myDelegate) { + console.log("delegate property incorrect - expected myDelegate"); + testObject.error = true; + } + if (testObject.animate && list.delegate != animatedDelegate) { + console.log("delegate property incorrect - expected animatedDelegate"); + testObject.error = true; + } + if (testObject.invalidHighlight && list.highlight != invalidHl) { + console.log("highlight property incorrect - expected invalidHl"); + testObject.error = true; + } + if (!testObject.invalidHighlight && list.highlight != myHighlight) { + console.log("highlight property incorrect - expected myHighlight"); + testObject.error = true; + } + } + resources: [ + Component { + id: myDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + height: 20 + width: 240 + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 120 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + } + }, + Component { + id: animatedDelegate + Rectangle { + id: wrapper + objectName: "wrapper" + height: 20 + width: 240 + Text { + text: index + } + Text { + x: 30 + id: textName + objectName: "textName" + text: name + } + Text { + x: 120 + id: textNumber + objectName: "textNumber" + text: number + } + Text { + x: 200 + text: wrapper.y + } + color: ListView.isCurrentItem ? "lightsteelblue" : "white" + ListView.onRemove: SequentialAnimation { + ScriptAction { script: console.log("Fix PropertyAction with attached properties") } +/* + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } + NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing.type: "InOutQuad" } + PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } +*/ + } + } + }, + Component { + id: myHighlight + Rectangle { color: "green" } + }, + Component { + id: invalidHl + EaseFollow {} + } + ] + ListView { + id: list + objectName: "list" + focus: true + width: 240 + height: 320 + model: testModel + delegate: testObject.animate ? animatedDelegate : myDelegate + highlight: testObject.invalidHighlight ? invalidHl : myHighlight + highlightMoveSpeed: 1000 + highlightResizeSpeed: 1000 + cacheBuffer: testObject.cacheBuffer + } +} diff --git a/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro new file mode 100644 index 0000000..3a076f8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/qdeclarativelistview.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativelistview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp new file mode 100644 index 0000000..f15f26b --- /dev/null +++ b/tests/auto/declarative/qdeclarativelistview/tst_qdeclarativelistview.cpp @@ -0,0 +1,1413 @@ +/**************************************************************************** +** +** 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 <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> + +class tst_QDeclarativeListView : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeListView(); + +private slots: + // Test both QListModelInterface and QAbstractItemModel model types + void qListModelInterface_items(); + void qAbstractItemModel_items(); + + void qListModelInterface_changed(); + void qAbstractItemModel_changed(); + + void qListModelInterface_inserted(); + void qAbstractItemModel_inserted(); + + void qListModelInterface_removed(); + void qAbstractItemModel_removed(); + + void qListModelInterface_moved(); + void qAbstractItemModel_moved(); + + void qListModelInterface_clear(); + void qAbstractItemModel_clear(); + + void itemList(); + void currentIndex(); + void enforceRange(); + void spacing(); + void sections(); + void cacheBuffer(); + void positionViewAtIndex(); + void resetModel(); + +private: + template <class T> void items(); + template <class T> void changed(); + template <class T> void inserted(); + template <class T> void removed(bool animated); + template <class T> void moved(); + template <class T> void clear(); + QDeclarativeView *createView(); + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); + template<typename T> + QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); + void dumpTree(QDeclarativeItem *parent, int depth = 0); +}; + +class TestObject : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool error READ error WRITE setError NOTIFY changedError) + Q_PROPERTY(bool animate READ animate NOTIFY changedAnim) + Q_PROPERTY(bool invalidHighlight READ invalidHighlight NOTIFY changedHl) + Q_PROPERTY(int cacheBuffer READ cacheBuffer NOTIFY changedCacheBuffer) + +public: + TestObject(QObject *parent = 0) + : QObject(parent), mError(true), mAnimate(false), mInvalidHighlight(false) + , mCacheBuffer(0) {} + + bool error() const { return mError; } + void setError(bool err) { mError = err; emit changedError(); } + + bool animate() const { return mAnimate; } + void setAnimate(bool anim) { mAnimate = anim; emit changedAnim(); } + + bool invalidHighlight() const { return mInvalidHighlight; } + void setInvalidHighlight(bool invalid) { mInvalidHighlight = invalid; emit changedHl(); } + + int cacheBuffer() const { return mCacheBuffer; } + void setCacheBuffer(int buffer) { mCacheBuffer = buffer; emit changedCacheBuffer(); } + +signals: + void changedError(); + void changedAnim(); + void changedHl(); + void changedCacheBuffer(); + +public: + bool mError; + bool mAnimate; + bool mInvalidHighlight; + int mCacheBuffer; +}; + +class TestModel : public QListModelInterface +{ + Q_OBJECT +public: + TestModel(QObject *parent = 0) : QListModelInterface(parent) {} + ~TestModel() {} + + enum Roles { Name, Number }; + + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + int count() const { return list.count(); } + + QList<int> roles() const { return QList<int>() << Name << Number; } + QString toString(int role) const { + switch(role) { + case Name: + return "name"; + case Number: + return "number"; + default: + return ""; + } + } + + QVariant data(int index, int role) const + { + if (role==0) + return list.at(index).first; + if (role==1) + return list.at(index).second; + return QVariant(); + } + QHash<int, QVariant> data(int index, const QList<int> &roles) const { + QHash<int,QVariant> returnHash; + + for (int i = 0; i < roles.size(); ++i) { + int role = roles.at(i); + QVariant info; + switch(role) { + case Name: + info = list.at(index).first; + break; + case Number: + info = list.at(index).second; + break; + default: + break; + } + returnHash.insert(role, info); + } + return returnHash; + } + + void addItem(const QString &name, const QString &number) { + list.append(QPair<QString,QString>(name, number)); + emit itemsInserted(list.count()-1, 1); + } + + void insertItem(int index, const QString &name, const QString &number) { + list.insert(index, QPair<QString,QString>(name, number)); + emit itemsInserted(index, 1); + } + + void removeItem(int index) { + list.removeAt(index); + emit itemsRemoved(index, 1); + } + + void moveItem(int from, int to) { + list.move(from, to); + emit itemsMoved(from, to, 1); + } + + void modifyItem(int index, const QString &name, const QString &number) { + list[index] = QPair<QString,QString>(name, number); + emit itemsChanged(index, 1, roles()); + } + + void clear() { + int count = list.count(); + list.clear(); + emit itemsRemoved(0, count); + } + +private: + QList<QPair<QString,QString> > list; +}; + + +class TestModel2 : public QAbstractListModel +{ +public: + enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; + + TestModel2(QObject *parent=0) : QAbstractListModel(parent) { + QHash<int, QByteArray> roles; + roles[Name] = "name"; + roles[Number] = "number"; + setRoleNames(roles); + } + + int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { + QVariant rv; + if (role == Name) + rv = list.at(index.row()).first; + else if (role == Number) + rv = list.at(index.row()).second; + + return rv; + } + + int count() const { return rowCount(); } + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + void addItem(const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()); + list.append(QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void insertItem(int index, const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), index, index); + list.insert(index, QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void removeItem(int index) { + emit beginRemoveRows(QModelIndex(), index, index); + list.removeAt(index); + emit endRemoveRows(); + } + + void moveItem(int from, int to) { + emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + list.move(from, to); + emit endMoveRows(); + } + + void modifyItem(int idx, const QString &name, const QString &number) { + list[idx] = QPair<QString,QString>(name, number); + emit dataChanged(index(idx,0), index(idx,0)); + } + + void clear() { + int count = list.count(); + emit beginRemoveRows(QModelIndex(), 0, count-1); + list.clear(); + emit endRemoveRows(); + } + +private: + QList<QPair<QString,QString> > list; +}; + +tst_QDeclarativeListView::tst_QDeclarativeListView() +{ +} + +template <class T> +void tst_QDeclarativeListView::items() +{ + QDeclarativeView *canvas = createView(); + + T model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + + QVERIFY(listview->highlightItem() != 0); + QCOMPARE(listview->count(), model.count()); + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + // current item should be first item + QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 0)); + + for (int i = 0; i < model.count(); ++i) { + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + // switch to other delegate + testObject->setAnimate(true); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + QVERIFY(listview->currentItem()); + + // set invalid highlight + testObject->setInvalidHighlight(true); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + QVERIFY(listview->currentItem()); + QVERIFY(listview->highlightItem() == 0); + + // back to normal highlight + testObject->setInvalidHighlight(false); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + QVERIFY(listview->currentItem()); + QVERIFY(listview->highlightItem() != 0); + + // set an empty model and confirm that items are destroyed + T model2; + ctxt->setContextProperty("testModel", &model2); + + // Allow deleteLaters to process + QTest::qWait(500); + + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(itemCount == 0); + + QCOMPARE(listview->highlightResizeSpeed(), 1000.0); + QCOMPARE(listview->highlightMoveSpeed(), 1000.0); + + delete canvas; +} + +template <class T> +void tst_QDeclarativeListView::changed() +{ + QDeclarativeView *canvas = createView(); + + T model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeFlickable *listview = findItem<QDeclarativeFlickable>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + model.modifyItem(1, "Will", "9876"); + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + delete canvas; +} + +template <class T> +void tst_QDeclarativeListView::inserted() +{ + QDeclarativeView *canvas = createView(); + + T model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + model.insertItem(1, "Will", "9876"); + + // let transitions settle. + QTest::qWait(500); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + QCOMPARE(item->y(), i*20.0); + } + + model.insertItem(0, "Foo", "1111"); // zero index, and current item + + // let transitions settle. + QTest::qWait(500); + + QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item + + name = findItem<QDeclarativeText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + QCOMPARE(listview->currentIndex(), 1); + + // Confirm items positioned correctly + for (int i = 0; i < model.count(); ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + QCOMPARE(item->y(), i*20.0); + } + + for (int i = model.count(); i < 30; ++i) + model.insertItem(i, "Hello", QString::number(i)); + QTest::qWait(500); + + listview->setContentY(80); + QTest::qWait(500); + + // Insert item outside visible area + model.insertItem(1, "Hello", "1324"); + QTest::qWait(500); + + QVERIFY(listview->contentY() == 80); + + // Confirm items positioned correctly + for (int i = 5; i < 5+15; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.0 - 20.0); + } + +// QCOMPARE(listview->viewportHeight(), model.count() * 20.0); + + delete canvas; +} + +template <class T> +void tst_QDeclarativeListView::removed(bool animated) +{ + QDeclarativeView *canvas = createView(); + + T model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + testObject->setAnimate(animated); + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + model.removeItem(1); + + // let transitions settle. + QTest::qWait(500); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + // Remove first item (which is the current item); + model.removeItem(0); // post: top item starts at 20 + + // let transitions settle. + QTest::qWait(500); + + name = findItem<QDeclarativeText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(),i*20.0 + 20.0); + } + + // Remove items not visible + model.removeItem(18); + // let transitions settle. + QTest::qWait(500); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(),i*20.0+20.0); + } + + // Remove items before visible + listview->setContentY(80); + listview->setCurrentIndex(10); + + model.removeItem(1); // post: top item will be at 40 + // let transitions settle. + QTest::qWait(500); + + // Confirm items positioned correctly + for (int i = 2; i < 18; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(),40+i*20.0); + } + + // Remove current index + QVERIFY(listview->currentIndex() == 9); + QDeclarativeItem *oldCurrent = listview->currentItem(); + model.removeItem(9); + QTest::qWait(500); + + QCOMPARE(listview->currentIndex(), 9); + QVERIFY(listview->currentItem() != oldCurrent); + + listview->setContentY(40); // That's the top now + // let transitions settle. + QTest::qWait(500); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(),40+i*20.0); + } + + // remove current item beyond visible items. + listview->setCurrentIndex(20); + QTest::qWait(500); + listview->setContentY(40); + model.removeItem(20); + QTest::qWait(500); + + QCOMPARE(listview->currentIndex(), 20); + QVERIFY(listview->currentItem() != 0); + + // remove item before current, but visible + listview->setCurrentIndex(8); + QTest::qWait(500); + oldCurrent = listview->currentItem(); + model.removeItem(6); + QTest::qWait(500); + + QCOMPARE(listview->currentIndex(), 7); + QVERIFY(listview->currentItem() == oldCurrent); + + delete canvas; +} + +template <class T> +void tst_QDeclarativeListView::clear() +{ + QDeclarativeView *canvas = createView(); + + T model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + model.clear(); + + // let transitions settle. + QTest::qWait(500); + + QVERIFY(listview->count() == 0); + QVERIFY(listview->currentItem() == 0); + QVERIFY(listview->contentY() == 0); + + delete canvas; +} + + +template <class T> +void tst_QDeclarativeListView::moved() +{ + QDeclarativeView *canvas = createView(); + + T model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + model.moveItem(1, 4); + + // let transitions settle. + QTest::qWait(500); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 1); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(1)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 1); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(1)); + + name = findItem<QDeclarativeText>(viewport, "textName", 4); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(4)); + number = findItem<QDeclarativeText>(viewport, "textNumber", 4); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(4)); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + listview->setContentY(80); + + // move outside visible area + model.moveItem(1, 18); + + // let transitions settle. + QTest::qWait(500); + + // Confirm items positioned correctly and indexes correct + for (int i = 3; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.0 + 20); + name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + // move from outside visible into visible + model.moveItem(20, 4); + + // let transitions settle. + QTest::qWait(500); + + // Confirm items positioned correctly and indexes correct + for (int i = 3; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.0 + 20); + name = findItem<QDeclarativeText>(viewport, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + number = findItem<QDeclarativeText>(viewport, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + delete canvas; +} + +void tst_QDeclarativeListView::enforceRange() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-enforcerange.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QCOMPARE(listview->preferredHighlightBegin(), 100.0); + QCOMPARE(listview->preferredHighlightEnd(), 100.0); + QCOMPARE(listview->highlightRangeMode(), QDeclarativeListView::StrictlyEnforceRange); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // view should be positioned at the top of the range. + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 0); + QVERIFY(item); + QCOMPARE(listview->contentY(), -100.0); + + QDeclarativeText *name = findItem<QDeclarativeText>(viewport, "textName", 0); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(0)); + QDeclarativeText *number = findItem<QDeclarativeText>(viewport, "textNumber", 0); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(0)); + + // Check currentIndex is updated when viewport moves + listview->setContentY(20); + QTest::qWait(500); + + QCOMPARE(listview->currentIndex(), 6); + + delete canvas; +} + +void tst_QDeclarativeListView::spacing() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + listview->setSpacing(10); + QVERIFY(listview->spacing() == 10); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*30); + } + + listview->setSpacing(0); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.0); + } + + delete canvas; +} + +void tst_QDeclarativeListView::sections() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i/5)); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview-sections.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + QVERIFY(item); + QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); + } + + // Remove section boundary + model.removeItem(5); + + // New section header created + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); + QVERIFY(item); + QCOMPARE(item->height(), 40.0); + + model.insertItem(3, "New Item", "0"); + + // Section header moved + item = findItem<QDeclarativeItem>(viewport, "wrapper", 5); + QVERIFY(item); + QCOMPARE(item->height(), 20.0); + + item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); + QVERIFY(item); + QCOMPARE(item->height(), 40.0); + + // insert item which will become a section header + model.insertItem(6, "Replace header", "1"); + + item = findItem<QDeclarativeItem>(viewport, "wrapper", 6); + QVERIFY(item); + QCOMPARE(item->height(), 40.0); + + item = findItem<QDeclarativeItem>(viewport, "wrapper", 7); + QVERIFY(item); + QCOMPARE(item->height(), 20.0); + + QCOMPARE(listview->currentSection(), QString("0")); + + listview->setContentY(140); + QCOMPARE(listview->currentSection(), QString("1")); + + listview->setContentY(20); + QCOMPARE(listview->currentSection(), QString("0")); + + item = findItem<QDeclarativeItem>(viewport, "wrapper", 1); + QVERIFY(item); + QCOMPARE(item->height(), 20.0); + + delete canvas; +} + +void tst_QDeclarativeListView::currentIndex() +{ + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), QString::number(i)); + + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + ctxt->setContextProperty("testWrap", QVariant(false)); + + QString filename(SRCDIR "/data/listview-initCurrent.qml"); + canvas->setSource(QUrl::fromLocalFile(filename)); + + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + QTest::qWait(500); + + // current item should be third item + QCOMPARE(listview->currentIndex(), 3); + QCOMPARE(listview->currentItem(), findItem<QDeclarativeItem>(viewport, "wrapper", 3)); + QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); + + // no wrap + listview->setCurrentIndex(0); + QCOMPARE(listview->currentIndex(), 0); + + listview->incrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 1); + listview->decrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 0); + + listview->decrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 0); + + // with wrap + ctxt->setContextProperty("testWrap", QVariant(true)); + QVERIFY(listview->isWrapEnabled()); + + listview->decrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), model.count()-1); + + QTest::qWait(1000); + QCOMPARE(listview->contentY(), 279.0); + + listview->incrementCurrentIndex(); + QCOMPARE(listview->currentIndex(), 0); + + QTest::qWait(1000); + QCOMPARE(listview->contentY(), 0.0); + + // Test keys + canvas->show(); + qApp->processEvents(); + + QEvent wa(QEvent::WindowActivate); + QApplication::sendEvent(canvas, &wa); + QFocusEvent fe(QEvent::FocusIn); + QApplication::sendEvent(canvas, &fe); + + QKeyEvent key(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + QCOMPARE(listview->currentIndex(), 1); + + key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1); + QApplication::sendEvent(canvas, &key); + QVERIFY(key.isAccepted()); + QCOMPARE(listview->currentIndex(), 0); + + // turn off auto highlight + listview->setHighlightFollowsCurrentItem(false); + QVERIFY(listview->highlightFollowsCurrentItem() == false); + + QTest::qWait(500); + QVERIFY(listview->highlightItem()); + qreal hlPos = listview->highlightItem()->y(); + + listview->setCurrentIndex(4); + QTest::qWait(500); + QCOMPARE(listview->highlightItem()->y(), hlPos); + + delete canvas; +} + +void tst_QDeclarativeListView::itemList() +{ + QDeclarativeView *canvas = createView(); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "view"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + QDeclarativeVisualItemModel *model = canvas->rootObject()->findChild<QDeclarativeVisualItemModel*>("itemModel"); + QVERIFY(model != 0); + + QVERIFY(model->count() == 3); + QCOMPARE(listview->currentIndex(), 0); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "item1"); + QVERIFY(item); + QCOMPARE(item->x(), 0.0); + + QDeclarativeText *text = findItem<QDeclarativeText>(viewport, "text1"); + QVERIFY(text); + QCOMPARE(text->text(), QLatin1String("index: 0")); + + listview->setCurrentIndex(2); + QTest::qWait(1000); + + item = findItem<QDeclarativeItem>(viewport, "item3"); + QVERIFY(item); + QCOMPARE(item->x(), 480.0); + + text = findItem<QDeclarativeText>(viewport, "text3"); + QVERIFY(text); + QCOMPARE(text->text(), QLatin1String("index: 2")); + + delete canvas; +} + +void tst_QDeclarativeListView::cacheBuffer() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 30; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + QVERIFY(listview->delegate() != 0); + QVERIFY(listview->model() != 0); + QVERIFY(listview->highlight() != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + testObject->setCacheBuffer(400); + QVERIFY(listview->cacheBuffer() == 400); + + int newItemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + QVERIFY(newItemCount > itemCount); + + // Confirm items positioned correctly + for (int i = 0; i < model.count() && i < newItemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QVERIFY(item->y() == i*20); + } + + delete canvas; +} + +void tst_QDeclarativeListView::positionViewAtIndex() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + for (int i = 0; i < 40; i++) + model.addItem("Item" + QString::number(i), ""); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/listview.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + // Confirm items positioned correctly + int itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.); + } + + // Position on a currently visible item + listview->positionViewAtIndex(3); + QCOMPARE(listview->contentY(), 60.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.); + } + + // Position on an item beyond the visible items + listview->positionViewAtIndex(22); + QCOMPARE(listview->contentY(), 440.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.); + } + + // Position on an item that would leave empty space if positioned at the top + listview->positionViewAtIndex(28); + QCOMPARE(listview->contentY(), 480.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.); + } + + // Position at the beginning again + listview->positionViewAtIndex(0); + QCOMPARE(listview->contentY(), 0.); + + // Confirm items positioned correctly + itemCount = findItems<QDeclarativeItem>(viewport, "wrapper").count(); + for (int i = 0; i < model.count() && i < itemCount-1; ++i) { + QDeclarativeItem *item = findItem<QDeclarativeItem>(viewport, "wrapper", i); + if (!item) qWarning() << "Item" << i << "not found"; + QVERIFY(item); + QCOMPARE(item->y(), i*20.); + } + + delete canvas; +} + +void tst_QDeclarativeListView::resetModel() +{ + QDeclarativeView *canvas = createView(); + + QStringList strings; + strings << "one" << "two" << "three"; + QStringListModel model(strings); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaylist.qml")); + qApp->processEvents(); + + QDeclarativeListView *listview = findItem<QDeclarativeListView>(canvas->rootObject(), "list"); + QVERIFY(listview != 0); + + QDeclarativeItem *viewport = listview->viewport(); + QVERIFY(viewport != 0); + + QCOMPARE(listview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } + + strings.clear(); + strings << "four" << "five" << "six" << "seven"; + model.setStringList(strings); + + QCOMPARE(listview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(viewport, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } +} + +void tst_QDeclarativeListView::qListModelInterface_items() +{ + items<TestModel>(); +} + +void tst_QDeclarativeListView::qAbstractItemModel_items() +{ + items<TestModel2>(); +} + +void tst_QDeclarativeListView::qListModelInterface_changed() +{ + changed<TestModel>(); +} + +void tst_QDeclarativeListView::qAbstractItemModel_changed() +{ + changed<TestModel2>(); +} + +void tst_QDeclarativeListView::qListModelInterface_inserted() +{ + inserted<TestModel>(); +} + +void tst_QDeclarativeListView::qAbstractItemModel_inserted() +{ + inserted<TestModel2>(); +} + +void tst_QDeclarativeListView::qListModelInterface_removed() +{ + removed<TestModel>(false); + removed<TestModel>(true); +} + +void tst_QDeclarativeListView::qAbstractItemModel_removed() +{ + removed<TestModel2>(false); + removed<TestModel2>(true); +} + +void tst_QDeclarativeListView::qListModelInterface_moved() +{ + moved<TestModel>(); +} + +void tst_QDeclarativeListView::qAbstractItemModel_moved() +{ + moved<TestModel2>(); +} + +void tst_QDeclarativeListView::qListModelInterface_clear() +{ + clear<TestModel>(); +} + +void tst_QDeclarativeListView::qAbstractItemModel_clear() +{ + clear<TestModel2>(); +} + +QDeclarativeView *tst_QDeclarativeListView::createView() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + return canvas; +} + +/* + Find an item with the specified objectName. If index is supplied then the + item must also evaluate the {index} expression equal to index +*/ +template<typename T> +T *tst_QDeclarativeListView::findItem(QGraphicsObject *parent, const QString &objectName, int index) +{ + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + if (index != -1) { + QDeclarativeExpression e(qmlContext(item), "index", item); + if (e.value().toInt() == index) + return static_cast<T*>(item); + } else { + return static_cast<T*>(item); + } + } + item = findItem<T>(item, objectName, index); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + +template<typename T> +QList<T*> tst_QDeclarativeListView::findItems(QGraphicsObject *parent, const QString &objectName) +{ + QList<T*> items; + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + items.append(static_cast<T*>(item)); + items += findItems<T>(item, objectName); + } + + return items; +} + +void tst_QDeclarativeListView::dumpTree(QDeclarativeItem *parent, int depth) +{ + static QString padding(" "); + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + qDebug() << padding.left(depth*2) << item; + dumpTree(item, depth+1); + } +} + + +QTEST_MAIN(tst_QDeclarativeListView) + +#include "tst_qdeclarativelistview.moc" diff --git a/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml new file mode 100644 index 0000000..4ebf366 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/data/GraphicsWidget250x250.qml @@ -0,0 +1,6 @@ +import Qt 4.6 +import Qt.widgets 4.6 + +QGraphicsWidget { + size: "250x250" +} diff --git a/tests/auto/declarative/qmlgraphicsloader/data/NoResize.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml index cfbb55a..cfbb55a 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/NoResize.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResize.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml index 5eab965..5eab965 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/NoResizeGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/NoResizeGraphicsWidget.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/Rect120x60.qml b/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml index aa4b0c2..aa4b0c2 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/Rect120x60.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/Rect120x60.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SetSourceComponent.qml b/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml index 1db56c4..1db56c4 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/SetSourceComponent.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SetSourceComponent.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml index 568a136..568a136 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/SizeGraphicsWidgetToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeGraphicsWidgetToLoader.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml index a710803..a710803 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/SizeLoaderToGraphicsWidget.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeLoaderToGraphicsWidget.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeToItem.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml index b52fa03..b52fa03 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/SizeToItem.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToItem.qml diff --git a/tests/auto/declarative/qmlgraphicsloader/data/SizeToLoader.qml b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml index 1a107e1..1a107e1 100644 --- a/tests/auto/declarative/qmlgraphicsloader/data/SizeToLoader.qml +++ b/tests/auto/declarative/qdeclarativeloader/data/SizeToLoader.qml diff --git a/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro new file mode 100644 index 0000000..8ff2be4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/qdeclarativeloader.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativeloader.cpp \ + ../shared/testhttpserver.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" + diff --git a/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp new file mode 100644 index 0000000..61b2800 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeloader/tst_qdeclarativeloader.cpp @@ -0,0 +1,464 @@ +/**************************************************************************** +** +** 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 <QtGui/QGraphicsWidget> +#include <QtGui/QGraphicsScene> + +#include <QSignalSpy> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeloader_p.h> +#include "testhttpserver.h" + +#define SERVER_PORT 14445 + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 6; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + +class tst_QDeclarativeLoader : public QObject + +{ + Q_OBJECT +public: + tst_QDeclarativeLoader(); + +private slots: + void url(); + void invalidUrl(); + void component(); + void clear(); + void urlToComponent(); + void componentToUrl(); + void sizeLoaderToItem(); + void sizeItemToLoader(); + void noResize(); + void sizeLoaderToGraphicsWidget(); + void sizeGraphicsWidgetToLoader(); + void noResizeGraphicsWidget(); + void networkRequestUrl(); + void failNetworkRequest(); +// void networkComponent(); + +private: + QDeclarativeEngine engine; +}; + + +tst_QDeclarativeLoader::tst_QDeclarativeLoader() +{ +} + +void tst_QDeclarativeLoader::url() +{ + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->item()); + QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + delete loader; +} + +void tst_QDeclarativeLoader::component() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); + QVERIFY(loader); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + delete loader; +} + +void tst_QDeclarativeLoader::invalidUrl() +{ + QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); + + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->item() == 0); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Error); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); + + delete loader; +} + +void tst_QDeclarativeLoader::clear() +{ + { + QDeclarativeComponent component(&engine); + component.setData(QByteArray( + "import Qt 4.6\n" + " Loader { id: loader\n" + " source: 'Rect120x60.qml'\n" + " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" + " }") + , TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + QTest::qWait(500); + + QVERIFY(loader->item() == 0); + QCOMPARE(loader->progress(), 0.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Null); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); + + delete loader; + } + { + QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); + QVERIFY(loader); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + loader->setSourceComponent(0); + + QVERIFY(loader->item() == 0); + QCOMPARE(loader->progress(), 0.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Null); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); + + delete loader; + } +} + +void tst_QDeclarativeLoader::urlToComponent() +{ + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\n" + "Loader {\n" + " id: loader\n" + " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" + " source: \"Rect120x60.qml\"\n" + " Timer { interval: 100; running: true; onTriggered: loader.sourceComponent = myComp }\n" + "}" ) + , TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QTest::qWait(500); + QVERIFY(loader != 0); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + QCOMPARE(loader->width(), 10.0); + QCOMPARE(loader->height(), 10.0); + + delete loader; +} + +void tst_QDeclarativeLoader::componentToUrl() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); + QVERIFY(loader); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + loader->setSource(TEST_FILE("/Rect120x60.qml")); + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + QCOMPARE(loader->width(), 120.0); + QCOMPARE(loader->height(), 60.0); + + delete loader; +} + +void tst_QDeclarativeLoader::sizeLoaderToItem() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SizeToItem.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeLoaderToItem); + QCOMPARE(loader->width(), 120.0); + QCOMPARE(loader->height(), 60.0); + + // Check resize + QDeclarativeItem *rect = qobject_cast<QDeclarativeItem*>(loader->item()); + QVERIFY(rect); + rect->setWidth(150); + rect->setHeight(45); + QCOMPARE(loader->width(), 150.0); + QCOMPARE(loader->height(), 45.0); + + // Switch mode + loader->setResizeMode(QDeclarativeLoader::SizeItemToLoader); + loader->setWidth(180); + loader->setHeight(30); + QCOMPARE(rect->width(), 180.0); + QCOMPARE(rect->height(), 30.0); + + // notify + QSignalSpy spy(loader, SIGNAL(resizeModeChanged())); + loader->setResizeMode(QDeclarativeLoader::NoResize); + QCOMPARE(spy.count(),1); + loader->setResizeMode(QDeclarativeLoader::NoResize); + QCOMPARE(spy.count(),1); +} + +void tst_QDeclarativeLoader::sizeItemToLoader() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SizeToLoader.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeItemToLoader); + QCOMPARE(loader->width(), 200.0); + QCOMPARE(loader->height(), 80.0); + + QDeclarativeItem *rect = qobject_cast<QDeclarativeItem*>(loader->item()); + QVERIFY(rect); + QCOMPARE(rect->width(), 200.0); + QCOMPARE(rect->height(), 80.0); + + // Check resize + loader->setWidth(180); + loader->setHeight(30); + QCOMPARE(rect->width(), 180.0); + QCOMPARE(rect->height(), 30.0); + + // Switch mode + loader->setResizeMode(QDeclarativeLoader::SizeLoaderToItem); + rect->setWidth(160); + rect->setHeight(45); + QCOMPARE(loader->width(), 160.0); + QCOMPARE(loader->height(), 45.0); +} + +void tst_QDeclarativeLoader::noResize() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/NoResize.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + QCOMPARE(loader->width(), 200.0); + QCOMPARE(loader->height(), 80.0); + + QDeclarativeItem *rect = qobject_cast<QDeclarativeItem*>(loader->item()); + QVERIFY(rect); + QCOMPARE(rect->width(), 120.0); + QCOMPARE(rect->height(), 60.0); +} + +void tst_QDeclarativeLoader::sizeLoaderToGraphicsWidget() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SizeLoaderToGraphicsWidget.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QGraphicsScene scene; + scene.addItem(loader); + + QVERIFY(loader != 0); + QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeLoaderToItem); + QCOMPARE(loader->width(), 250.0); + QCOMPARE(loader->height(), 250.0); + + // Check resize + QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); + QVERIFY(widget); + widget->resize(QSizeF(150,45)); + QCOMPARE(loader->width(), 150.0); + QCOMPARE(loader->height(), 45.0); + + // Switch mode + loader->setResizeMode(QDeclarativeLoader::SizeItemToLoader); + loader->setWidth(180); + loader->setHeight(30); + QCOMPARE(widget->size().width(), 180.0); + QCOMPARE(widget->size().height(), 30.0); +} + +void tst_QDeclarativeLoader::sizeGraphicsWidgetToLoader() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/SizeGraphicsWidgetToLoader.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QGraphicsScene scene; + scene.addItem(loader); + + QVERIFY(loader != 0); + QVERIFY(loader->resizeMode() == QDeclarativeLoader::SizeItemToLoader); + QCOMPARE(loader->width(), 200.0); + QCOMPARE(loader->height(), 80.0); + + QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); + QVERIFY(widget); + QCOMPARE(widget->size().width(), 200.0); + QCOMPARE(widget->size().height(), 80.0); + + // Check resize + loader->setWidth(180); + loader->setHeight(30); + QCOMPARE(widget->size().width(), 180.0); + QCOMPARE(widget->size().height(), 30.0); + + // Switch mode + loader->setResizeMode(QDeclarativeLoader::SizeLoaderToItem); + widget->resize(QSizeF(160,45)); + QCOMPARE(loader->width(), 160.0); + QCOMPARE(loader->height(), 45.0); +} + +void tst_QDeclarativeLoader::noResizeGraphicsWidget() +{ + QDeclarativeComponent component(&engine, TEST_FILE("/NoResizeGraphicsWidget.qml")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QGraphicsScene scene; + scene.addItem(loader); + + QVERIFY(loader != 0); + QCOMPARE(loader->width(), 200.0); + QCOMPARE(loader->height(), 80.0); + + QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); + QVERIFY(widget); + QCOMPARE(widget->size().width(), 250.0); + QCOMPARE(widget->size().height(), 250.0); +} + +void tst_QDeclarativeLoader::networkRequestUrl() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + + TRY_WAIT(loader->status() == QDeclarativeLoader::Ready); + + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + delete loader; +} + +/* XXX Component waits until all dependencies are loaded. Is this actually possible? +void tst_QDeclarativeLoader::networkComponent() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory("slowdata", TestHTTPServer::Delay); + + QDeclarativeComponent component(&engine); + component.setData(QByteArray( + "import Qt 4.6\n" + "import \"http://127.0.0.1:14445/\" as NW\n" + "Item {\n" + " Component { id: comp; NW.SlowRect {} }\n" + " Loader { sourceComponent: comp } }") + , TEST_FILE("")); + + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(item); + + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(item->QGraphicsObject::children().at(1)); + QVERIFY(loader); + TRY_WAIT(loader->status() == QDeclarativeLoader::Ready); + + QVERIFY(loader->item()); + QCOMPARE(loader->progress(), 1.0); + QCOMPARE(loader->status(), QDeclarativeLoader::Ready); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); + + delete loader; +} +*/ + +void tst_QDeclarativeLoader::failNetworkRequest() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.serveDirectory(SRCDIR "/data"); + + QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); + + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), TEST_FILE("")); + QDeclarativeLoader *loader = qobject_cast<QDeclarativeLoader*>(component.create()); + QVERIFY(loader != 0); + + TRY_WAIT(loader->status() == QDeclarativeLoader::Error); + + QVERIFY(loader->item() == 0); + QCOMPARE(loader->progress(), 0.0); + QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); + + delete loader; +} + +QTEST_MAIN(tst_QDeclarativeLoader) + +#include "tst_qdeclarativeloader.moc" diff --git a/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro new file mode 100644 index 0000000..2f7ff82 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetatype/qdeclarativemetatype.pro @@ -0,0 +1,6 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativemetatype.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp new file mode 100644 index 0000000..818f108 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemetatype/tst_qdeclarativemetatype.cpp @@ -0,0 +1,378 @@ +/**************************************************************************** +** +** 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 <QLocale> +#include <QPixmap> +#include <QBitmap> +#include <QPen> +#include <QTextLength> +#include <QMatrix4x4> +#include <QVector2D> +#include <QVector3D> +#include <QVector4D> +#include <QQuaternion> +#include <qdeclarative.h> + +#include <private/qdeclarativemetatype_p.h> + +class tst_qdeclarativemetatype : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativemetatype() {} + +private slots: + void initTestCase(); + + void copy(); + + void qmlParserStatusCast(); + void qmlPropertyValueSourceCast(); + void qmlPropertyValueInterceptorCast(); + + void isList(); + + void defaultObject(); +}; + +class TestType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo); + + Q_CLASSINFO("DefaultProperty", "foo"); +public: + int foo() { return 0; } +}; +QML_DECLARE_TYPE(TestType); + +class ParserStatusTestType : public QObject, public QDeclarativeParserStatus +{ + Q_OBJECT + Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property +}; +QML_DECLARE_TYPE(ParserStatusTestType); + +class ValueSourceTestType : public QObject, public QDeclarativePropertyValueSource +{ + Q_OBJECT + Q_INTERFACES(QDeclarativePropertyValueSource) +public: + virtual void setTarget(const QDeclarativeProperty &) {} +}; +QML_DECLARE_TYPE(ValueSourceTestType); + +class ValueInterceptorTestType : public QObject, public QDeclarativePropertyValueInterceptor +{ + Q_OBJECT + Q_INTERFACES(QDeclarativePropertyValueInterceptor) +public: + virtual void setTarget(const QDeclarativeProperty &) {} + virtual void write(const QVariant &) {} +}; +QML_DECLARE_TYPE(ValueInterceptorTestType); + + +#define COPY_TEST(cpptype, metatype, value, defaultvalue) \ +{ \ + cpptype v = (value); cpptype v2 = (value); \ + QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, 0)); \ + QVERIFY(v == (defaultvalue)); \ + QVERIFY(QDeclarativeMetaType::copy(QMetaType:: metatype, &v, &v2)); \ + QVERIFY(v == (value)); \ +} + +#define QT_COPY_TEST(type, value) \ +{ \ + type v = (value); type v2 = (value); \ + QVERIFY(QDeclarativeMetaType::copy(QMetaType:: type, &v, 0)); \ + QVERIFY(v == (type ())); \ + QVERIFY(QDeclarativeMetaType::copy(QMetaType:: type, &v, &v2)); \ + QVERIFY(v == (value)); \ +} + +void tst_qdeclarativemetatype::initTestCase() +{ + QML_REGISTER_TYPE(Test, 1, 0, TestType, TestType); + QML_REGISTER_TYPE(Test, 1, 0, ParserStatusTestType, ParserStatusTestType); + QML_REGISTER_TYPE(Test, 1, 0, ValueSourceTestType, ValueSourceTestType); + QML_REGISTER_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); +} + +void tst_qdeclarativemetatype::copy() +{ + QVERIFY(QDeclarativeMetaType::copy(QMetaType::Void, 0, 0)); + + COPY_TEST(bool, Bool, true, false); + COPY_TEST(int, Int, 10, 0); + COPY_TEST(unsigned int, UInt, 10, 0); + COPY_TEST(long long, LongLong, 10, 0); + COPY_TEST(unsigned long long, ULongLong, 10, 0); + COPY_TEST(double, Double, 19.2, 0); + + QT_COPY_TEST(QChar, QChar('a')); + + QVariantMap variantMap; + variantMap.insert("Hello World!", QVariant(10)); + QT_COPY_TEST(QVariantMap, variantMap); + + QT_COPY_TEST(QVariantList, QVariantList() << QVariant(19.2)); + QT_COPY_TEST(QString, QString("QML Rocks!")); + QT_COPY_TEST(QStringList, QStringList() << "QML" << "Rocks"); + QT_COPY_TEST(QByteArray, QByteArray("0x1102DDD")); + QT_COPY_TEST(QBitArray, QBitArray(102, true)); + QDate cd = QDate::currentDate(); + QT_COPY_TEST(QDate, cd); + QTime ct = QTime::currentTime(); + QT_COPY_TEST(QTime, ct); + QDateTime cdt = QDateTime::currentDateTime(); + QT_COPY_TEST(QDateTime, cdt); + QT_COPY_TEST(QUrl, QUrl("http://www.nokia.com")); + QT_COPY_TEST(QLocale, QLocale(QLocale::English, QLocale::Australia)); + QT_COPY_TEST(QRect, QRect(-10, 10, 102, 99)); + QT_COPY_TEST(QRectF, QRectF(-10.2, 1.2, 102, 99.6)); + QT_COPY_TEST(QSize, QSize(100, 2)); + QT_COPY_TEST(QSizeF, QSizeF(20.2, -100234.2)); + QT_COPY_TEST(QLine, QLine(0, 0, 100, 100)); + QT_COPY_TEST(QLineF, QLineF(-10.2, 0, 103, 1)); + QT_COPY_TEST(QPoint, QPoint(-1912, 1613)); + QT_COPY_TEST(QPointF, QPointF(-908.1, 1612)); + QT_COPY_TEST(QRegExp, QRegExp("(\\d+)(?:\\s*)(cm|inch)")); + + QVariantHash variantHash; + variantHash.insert("Hello World!", QVariant(19)); + QT_COPY_TEST(QVariantHash, variantHash); + +#ifdef QT3_SUPPORT + QT_COPY_TEST(QColorGroup, QColorGroup(Qt::red, Qt::red, Qt::red, Qt::red, Qt::red, Qt::red, Qt::red)); +#endif + + QT_COPY_TEST(QFont, QFont("Helvetica", 1024)); + + { + QPixmap v = QPixmap(100, 100); QPixmap v2 = QPixmap(100, 100); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QPixmap, &v, 0)); + QVERIFY(v.size() == QPixmap().size()); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QPixmap , &v, &v2)); + QVERIFY(v.size() == QPixmap(100,100).size()); + } + + QT_COPY_TEST(QBrush, QBrush(Qt::blue)); + QT_COPY_TEST(QColor, QColor("lightsteelblue")); + QT_COPY_TEST(QPalette, QPalette(Qt::green)); + + { + QPixmap icon(100, 100); + + QIcon v = QIcon(icon); QIcon v2 = QIcon(icon); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QIcon, &v, 0)); + QVERIFY(v.isNull() == QIcon().isNull()); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QIcon , &v, &v2)); + QVERIFY(v.isNull() == QIcon(icon).isNull()); + } + + { + QImage v = QImage(100, 100, QImage::Format_RGB32); + QImage v2 = QImage(100, 100, QImage::Format_RGB32); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QImage, &v, 0)); + QVERIFY(v.size() == QImage().size()); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QImage , &v, &v2)); + QVERIFY(v.size() == QImage(100,100, QImage::Format_RGB32).size()); + } + + QT_COPY_TEST(QPolygon, QPolygon(QRect(100, 100, 200, 103))); + QT_COPY_TEST(QRegion, QRegion(QRect(0, 10, 99, 87))); + + { + QBitmap v = QBitmap(100, 100); QBitmap v2 = QBitmap(100, 100); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QBitmap, &v, 0)); + QVERIFY(v.size() == QBitmap().size()); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QBitmap , &v, &v2)); + QVERIFY(v.size() == QBitmap(100,100).size()); + } + + { + QCursor v = QCursor(Qt::SizeFDiagCursor); QCursor v2 = QCursor(Qt::SizeFDiagCursor); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QCursor, &v, 0)); + QVERIFY(v.shape() == QCursor().shape()); + QVERIFY(QDeclarativeMetaType::copy(QMetaType::QCursor , &v, &v2)); + QVERIFY(v.shape() == QCursor(Qt::SizeFDiagCursor).shape()); + } + + QT_COPY_TEST(QSizePolicy, QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum)); + QT_COPY_TEST(QKeySequence, QKeySequence("Ctrl+O")); + QT_COPY_TEST(QPen, QPen(Qt::red)); + QT_COPY_TEST(QTextLength, QTextLength(QTextLength::FixedLength, 10.2)); + QT_COPY_TEST(QTextFormat, QTextFormat(QTextFormat::ListFormat)); + QT_COPY_TEST(QMatrix, QMatrix().translate(10, 10)); + QT_COPY_TEST(QTransform, QTransform().translate(10, 10)); + QT_COPY_TEST(QMatrix4x4, QMatrix4x4(1,0,2,3,0,1,0,0,9,0,1,0,0,0,10,1)); + QT_COPY_TEST(QVector2D, QVector2D(10.2, 1)); + QT_COPY_TEST(QVector3D, QVector3D(10.2, 1, -2)); + QT_COPY_TEST(QVector4D, QVector4D(10.2, 1, -2, 1.2)); + QT_COPY_TEST(QQuaternion, QQuaternion(1.0, 10.2, 1, -2)); + + int voidValue; + COPY_TEST(void *, VoidStar, (void *)&voidValue, (void *)0); + COPY_TEST(long, Long, 10, 0); + COPY_TEST(short, Short, 10, 0); + COPY_TEST(char, Char, 'a', 0); + COPY_TEST(unsigned long, ULong, 10, 0); + COPY_TEST(unsigned short, UShort, 10, 0); + COPY_TEST(unsigned char, UChar, 'a', 0); + COPY_TEST(float, Float, 10.5, 0); + + QObject objectValue; + QWidget widgetValue; + COPY_TEST(QObject *, QObjectStar, &objectValue, 0); + COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0); + COPY_TEST(qreal, QReal, 10.2, 0); + + { + QVariant tv = QVariant::fromValue(QVariant(10)); + QVariant v(tv); QVariant v2(tv); + QVERIFY(QDeclarativeMetaType::copy(qMetaTypeId<QVariant>(), &v, 0)); + QVERIFY(v == QVariant()); + QVERIFY(QDeclarativeMetaType::copy(qMetaTypeId<QVariant>(), &v, &v2)); + QVERIFY(v == tv); + } + + { + TestType t; QVariant tv = QVariant::fromValue(&t); + + QVariant v(tv); QVariant v2(tv); + QVERIFY(QDeclarativeMetaType::copy(qMetaTypeId<TestType *>(), &v, 0)); + QVERIFY(v == QVariant::fromValue((TestType *)0)); + QVERIFY(QDeclarativeMetaType::copy(qMetaTypeId<TestType *>(), &v, &v2)); + QVERIFY(v == tv); + } +} + +void tst_qdeclarativemetatype::qmlParserStatusCast() +{ + QVERIFY(QDeclarativeMetaType::qmlType(QVariant::Int) == 0); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1); + + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); + int cast = QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast(); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ParserStatusTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QDeclarativeParserStatus *)&t)); + + QDeclarativeParserStatus *status = reinterpret_cast<QDeclarativeParserStatus *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(status, &t); +} + +void tst_qdeclarativemetatype::qmlPropertyValueSourceCast() +{ + QVERIFY(QDeclarativeMetaType::qmlType(QVariant::Int) == 0); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1); + + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); + int cast = QDeclarativeMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast(); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ValueSourceTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QDeclarativePropertyValueSource *)&t)); + + QDeclarativePropertyValueSource *source = reinterpret_cast<QDeclarativePropertyValueSource *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(source, &t); +} + +void tst_qdeclarativemetatype::qmlPropertyValueInterceptorCast() +{ + QVERIFY(QDeclarativeMetaType::qmlType(QVariant::Int) == 0); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1); + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); + QCOMPARE(QDeclarativeMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1); + + QVERIFY(QDeclarativeMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0); + int cast = QDeclarativeMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast(); + QVERIFY(cast != -1); + QVERIFY(cast != 0); + + ValueInterceptorTestType t; + QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QDeclarativePropertyValueInterceptor *)&t)); + + QDeclarativePropertyValueInterceptor *interceptor = reinterpret_cast<QDeclarativePropertyValueInterceptor *>(reinterpret_cast<char *>((QObject *)&t) + cast); + QCOMPARE(interceptor, &t); +} + +void tst_qdeclarativemetatype::isList() +{ + QCOMPARE(QDeclarativeMetaType::isList(QVariant::Invalid), false); + QCOMPARE(QDeclarativeMetaType::isList(QVariant::Int), false); + + QDeclarativeListProperty<TestType> list; + + QCOMPARE(QDeclarativeMetaType::isList(qMetaTypeId<QDeclarativeListProperty<TestType> >()), true); +} + +void tst_qdeclarativemetatype::defaultObject() +{ + QVERIFY(QDeclarativeMetaType::defaultProperty(&QObject::staticMetaObject).name() == 0); + QVERIFY(QDeclarativeMetaType::defaultProperty(&ParserStatusTestType::staticMetaObject).name() == 0); + QCOMPARE(QString(QDeclarativeMetaType::defaultProperty(&TestType::staticMetaObject).name()), QString("foo")); + + QObject o; + TestType t; + ParserStatusTestType p; + + QVERIFY(QDeclarativeMetaType::defaultProperty((QObject *)0).name() == 0); + QVERIFY(QDeclarativeMetaType::defaultProperty(&o).name() == 0); + QVERIFY(QDeclarativeMetaType::defaultProperty(&p).name() == 0); + QCOMPARE(QString(QDeclarativeMetaType::defaultProperty(&t).name()), QString("foo")); +} + +QTEST_MAIN(tst_qdeclarativemetatype) + +#include "tst_qdeclarativemetatype.moc" diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir b/tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir new file mode 100644 index 0000000..0a8b5d4 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/com/nokia/AutoTestQmlPluginType/qmldir @@ -0,0 +1 @@ +plugin plugin diff --git a/tests/auto/declarative/qmlmoduleplugin/plugin.qml b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml index f29ae24..f29ae24 100644 --- a/tests/auto/declarative/qmlmoduleplugin/plugin.qml +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin.qml diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp new file mode 100644 index 0000000..fd94cc6 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.cpp @@ -0,0 +1,85 @@ +/**************************************************************************** +** +** 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 <QStringList> +#include <QtDeclarative/qdeclarativeextensionplugin.h> +#include <QtDeclarative/qdeclarative.h> +#include <QDebug> + +class MyPluginType : public QObject +{ + Q_OBJECT + Q_PROPERTY(int value READ value WRITE setValue) + +public: + MyPluginType(QObject *parent=0) : QObject(parent) + { + qWarning("import worked"); + } + + int value() const { return v; } + void setValue(int i) { v = i; } + +private: + int v; +}; + +QML_DECLARE_TYPE(MyPluginType); + + +class MyPlugin : public QDeclarativeExtensionPlugin +{ + Q_OBJECT +public: + MyPlugin() + { + qWarning("plugin created"); + } + + void registerTypes(const char *uri) + { + Q_ASSERT(QLatin1String(uri) == "com.nokia.AutoTestQmlPluginType"); + qmlRegisterType<MyPluginType>(uri, 1, 0, "MyPluginType"); + } +}; + +#include "plugin.moc" + +Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro new file mode 100644 index 0000000..035cb7d --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/plugin/plugin.pro @@ -0,0 +1,6 @@ +TEMPLATE = lib +CONFIG += plugin +SOURCES = plugin.cpp +QT = core declarative +DESTDIR = ../com/nokia/AutoTestQmlPluginType + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro new file mode 100644 index 0000000..96f4454 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/qdeclarativemoduleplugin.pro @@ -0,0 +1,7 @@ +QT = core +TEMPLATE = subdirs +SUBDIRS = plugin +tst_qdeclarativemoduleplugin_pro.depends += plugin +SUBDIRS += tst_qdeclarativemoduleplugin.pro + + diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp new file mode 100644 index 0000000..f3caa7f --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.cpp @@ -0,0 +1,117 @@ +/**************************************************************************** +** +** 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 <qdir.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QDebug> + +class tst_qdeclarativemoduleplugin : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativemoduleplugin() { + QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin")); +qDebug() << QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"); + } + +private slots: + void importsPlugin(); +}; + +#define VERIFY_ERRORS(errorfile) \ + if (!errorfile) { \ + if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ + qWarning() << "Unexpected Errors:" << component.errors(); \ + QVERIFY(!component.isError()); \ + QVERIFY(component.errors().isEmpty()); \ + } else { \ + QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ + QVERIFY(file.open(QIODevice::ReadOnly)); \ + QByteArray data = file.readAll(); \ + file.close(); \ + QList<QByteArray> expected = data.split('\n'); \ + expected.removeAll(QByteArray("")); \ + QList<QDeclarativeError> errors = component.errors(); \ + QList<QByteArray> actual; \ + for (int ii = 0; ii < errors.count(); ++ii) { \ + const QDeclarativeError &error = errors.at(ii); \ + QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ + QByteArray::number(error.column()) + ":" + \ + error.description().toUtf8(); \ + actual << errorStr; \ + } \ + if (qgetenv("DEBUG") != "" && expected != actual) \ + qWarning() << "Expected:" << expected << "Actual:" << actual; \ + if (qgetenv("QDECLARATIVELANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ + QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ + QVERIFY(file.open(QIODevice::WriteOnly)); \ + for (int ii = 0; ii < actual.count(); ++ii) { \ + file.write(actual.at(ii)); file.write("\n"); \ + } \ + file.close(); \ + } else { \ + QCOMPARE(expected, actual); \ + } \ + } + +inline QUrl TEST_FILE(const QString &filename) +{ + QFileInfo fileInfo(__FILE__); + return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); +} + + +void tst_qdeclarativemoduleplugin::importsPlugin() +{ + QDeclarativeEngine engine; + QTest::ignoreMessage(QtWarningMsg, "plugin created"); + QTest::ignoreMessage(QtWarningMsg, "import worked"); + QDeclarativeComponent component(&engine, TEST_FILE("plugin.qml")); + VERIFY_ERRORS(0); + QObject *object = component.create(); + QVERIFY(object != 0); + QCOMPARE(object->property("value").toInt(),123); +} + +QTEST_MAIN(tst_qdeclarativemoduleplugin) + +#include "tst_qdeclarativemoduleplugin.moc" diff --git a/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro new file mode 100644 index 0000000..d895ed0 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemoduleplugin/tst_qdeclarativemoduleplugin.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +SOURCES = tst_qdeclarativemoduleplugin.cpp +QT += declarative +CONFIG -= app_bundle +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsmousearea/data/dragproperties.qml b/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml index 4cd78da..4cd78da 100644 --- a/tests/auto/declarative/qmlgraphicsmousearea/data/dragproperties.qml +++ b/tests/auto/declarative/qdeclarativemousearea/data/dragproperties.qml diff --git a/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro new file mode 100644 index 0000000..d01955b --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/qdeclarativemousearea.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +HEADERS += ../shared/testhttpserver.h +SOURCES += tst_qdeclarativemousearea.cpp ../shared/testhttpserver.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp new file mode 100644 index 0000000..769cf32 --- /dev/null +++ b/tests/auto/declarative/qdeclarativemousearea/tst_qdeclarativemousearea.cpp @@ -0,0 +1,138 @@ +/**************************************************************************** +** +** Copyright (C) 2009 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 <QtTest/QtTest> +#include <QtTest/QSignalSpy> +#include <private/qdeclarativemousearea_p.h> +#include <QtDeclarative/qdeclarativeview.h> + +class tst_QDeclarativeMouseArea: public QObject +{ + Q_OBJECT +private slots: + void dragProperties(); +private: + QDeclarativeView *createView(const QString &filename); +}; + +void tst_QDeclarativeMouseArea::dragProperties() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/dragproperties.qml"); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeMouseArea *mouseRegion = canvas->rootObject()->findChild<QDeclarativeMouseArea*>("mouseregion"); + QDeclarativeDrag *drag = mouseRegion->drag(); + QVERIFY(mouseRegion != 0); + QVERIFY(drag != 0); + + // target + QDeclarativeItem *blackRect = canvas->rootObject()->findChild<QDeclarativeItem*>("blackrect"); + QVERIFY(blackRect != 0); + QVERIFY(blackRect == drag->target()); + QDeclarativeItem *rootItem = qobject_cast<QDeclarativeItem*>(canvas->rootObject()); + QVERIFY(rootItem != 0); + QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); + drag->setTarget(rootItem); + QCOMPARE(targetSpy.count(),1); + drag->setTarget(rootItem); + QCOMPARE(targetSpy.count(),1); + + // axis + QCOMPARE(drag->axis(), QDeclarativeDrag::XandYAxis); + QSignalSpy axisSpy(drag, SIGNAL(axisChanged())); + drag->setAxis(QDeclarativeDrag::XAxis); + QCOMPARE(drag->axis(), QDeclarativeDrag::XAxis); + QCOMPARE(axisSpy.count(),1); + drag->setAxis(QDeclarativeDrag::XAxis); + QCOMPARE(axisSpy.count(),1); + + // minimum and maximum properties + QSignalSpy xminSpy(drag, SIGNAL(minimumXChanged())); + QSignalSpy xmaxSpy(drag, SIGNAL(maximumXChanged())); + QSignalSpy yminSpy(drag, SIGNAL(minimumYChanged())); + QSignalSpy ymaxSpy(drag, SIGNAL(maximumYChanged())); + + QCOMPARE(drag->xmin(), 0.0); + QCOMPARE(drag->xmax(), rootItem->width()-blackRect->width()); + QCOMPARE(drag->ymin(), 0.0); + QCOMPARE(drag->ymax(), rootItem->height()-blackRect->height()); + + drag->setXmin(10); + drag->setXmax(10); + drag->setYmin(10); + drag->setYmax(10); + + QCOMPARE(drag->xmin(), 10.0); + QCOMPARE(drag->xmax(), 10.0); + QCOMPARE(drag->ymin(), 10.0); + QCOMPARE(drag->ymax(), 10.0); + + QCOMPARE(xminSpy.count(),1); + QCOMPARE(xmaxSpy.count(),1); + QCOMPARE(yminSpy.count(),1); + QCOMPARE(ymaxSpy.count(),1); + + drag->setXmin(10); + drag->setXmax(10); + drag->setYmin(10); + drag->setYmax(10); + + QCOMPARE(xminSpy.count(),1); + QCOMPARE(xmaxSpy.count(),1); + QCOMPARE(yminSpy.count(),1); + QCOMPARE(ymaxSpy.count(),1); +} + +QDeclarativeView *tst_QDeclarativeMouseArea::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + canvas->setSource(QUrl::fromLocalFile(filename)); + + return canvas; +} + +QTEST_MAIN(tst_QDeclarativeMouseArea) + +#include "tst_qdeclarativemousearea.moc" diff --git a/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro b/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro new file mode 100644 index 0000000..672e95c --- /dev/null +++ b/tests/auto/declarative/qdeclarativenumberformatter/qdeclarativenumberformatter.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativenumberformatter.cpp diff --git a/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp new file mode 100644 index 0000000..26ff3d5 --- /dev/null +++ b/tests/auto/declarative/qdeclarativenumberformatter/tst_qdeclarativenumberformatter.cpp @@ -0,0 +1,222 @@ +/**************************************************************************** +** +** 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 <QDebug> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qnumberformat_p.h> +#include <private/qdeclarativenumberformatter_p.h> + +class tst_qdeclarativenumberformatter : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativenumberformatter(); + + void init() {} + void initTestCase() {} + + void cleanup() {} + void cleanupTestCase() {} + +private slots: + void text_data(); + void text(); + +private: + QStringList strings; + QStringList formats; + QStringList texts; +}; + +tst_qdeclarativenumberformatter::tst_qdeclarativenumberformatter() +{ + strings << "100.0" + << "12345" + << "1234567" + << "0.123" + << "0.9999" + << "0.989" + << "1" + << "1.0" + << "1.01"; + + formats << "" + << "0000" + << "0000.00" + << "##" + << "##.##" + << "#0.00#" + << "##,##0.##" + << "(000) 000 - 000" + << "00000,000.0000"; + + //US locale only. + texts << "100.000000" + << "12345.000000" + << "1234567.000000" + << "0.123000" + << "0.999900" + << "0.989000" + << "1.000000" + << "1.000000" + << "1.010000" //end "" + << "0100" + << "12345" + << "1234567" + << "0000" + << "0001" + << "0001" + << "0001" + << "0001" + << "0001" // end "0000" + << "0100.00" + << "12345.00" + << "1234567.00" + << "0000.12" + << "0001.00" + << "0000.99" + << "0001.00" + << "0001.00" + << "0001.01" // end "0000.00" + << "100" + << "12345" + << "1234567" + << "0" + << "1" + << "1" + << "1" + << "1" + << "1" // end "##" + << "100"//start "##.##" + << "12345" + << "1234567" + << "0.12" + << "1" + << "0.99" + << "1" + << "1" + << "1.01" // end "##.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug + << "100.00" //start "#0.00#" + << "12345.00" + << "1234567.00" + << "0.123" + << "1.00" + << "0.989" + << "1.00" + << "1.00" + << "1.01" //end "#0.00#" + << "100" //start "##,##0.##" + << "12,345" + << "1,234,567" + << "0.12" + << "1" + << "0.99" + << "1" + << "1" + << "1.01" //end "##,##0.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug + << "(000) 000 - 100" //start "(000) 000 - 000" + << "(000) 012 - 345" + << "(001) 234 - 567" + << "(000) 000 - 000" + << "(000) 000 - 001" + << "(000) 000 - 001" + << "(000) 000 - 001" + << "(000) 000 - 001" + << "(000) 000 - 001" // end "(000) 000 - 000" + << "00,000,100.0000" // start "00000,000.0000" + << "00,012,345.0000" + << "01,234,567.0000" + << "00,000,000.1230" + << "00,000,000.9999" + << "00,000,000.9890" + << "00,000,001.0000" + << "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() +{ + QTest::addColumn<QString>("string"); + QTest::addColumn<QString>("format"); + QTest::addColumn<QString>("text"); + + for (int j=0; j < formats.size(); j++) + { + for (int i=0; i < strings.size(); i++) + { + QTest::newRow(QString("%1, %2").arg(strings.at(i)).arg(formats.at(j)).toAscii()) + << strings.at(i) << formats.at(j) << texts.at(j*formats.size()+i); + } + } + +} + +void tst_qdeclarativenumberformatter::text() +{ + QFETCH(QString, string); + QFETCH(QString, format); + QFETCH(QString, text); + + QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: ") + string + QString("; format: \"") + format + QString("\" }"); + + QDeclarativeEngine engine; + QDeclarativeComponent formatterComponent(&engine); + formatterComponent.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); + if(formatterComponent.isError()) + qDebug() << formatterComponent.errors(); + QVERIFY(formatterComponent.isReady()); + QDeclarativeNumberFormatter *formatter = qobject_cast<QDeclarativeNumberFormatter*>(formatterComponent.create()); + QVERIFY(formatter != 0); + + QCOMPARE(formatter->format(), format); + QCOMPARE(formatter->text(), text); + + delete formatter; +} + +QTEST_MAIN(tst_qdeclarativenumberformatter) + +#include "tst_qdeclarativenumberformatter.moc" diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particle.png b/tests/auto/declarative/qdeclarativeparticles/data/particle.png Binary files differindex defbde5..defbde5 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/data/particle.png +++ b/tests/auto/declarative/qdeclarativeparticles/data/particle.png diff --git a/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml b/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml new file mode 100644 index 0000000..ace61fe --- /dev/null +++ b/tests/auto/declarative/qdeclarativeparticles/data/particlemotion.qml @@ -0,0 +1,33 @@ +import Qt 4.6 +Rectangle { + width: 240 + height: 320 + color: "black" + Particles { + objectName: "particles" + anchors.fill: parent + width: 1 + height: 1 + source: "particle.png" + lifeSpan: 5000 + count: 200 + angle: 270 + angleDeviation: 45 + velocity: 50 + velocityDeviation: 30 + ParticleMotionGravity { + objectName: "motionGravity" + yattractor: 1000 + xattractor: 0 + acceleration: 25 + } + } + resources: [ + ParticleMotionWander { + objectName: "motionWander" + xvariance: 30 + yvariance: 30 + pace: 100 + } + ] +}
\ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml index c58927e..c58927e 100644 --- a/tests/auto/declarative/qmlgraphicsparticles/data/particles.qml +++ b/tests/auto/declarative/qdeclarativeparticles/data/particles.qml diff --git a/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro new file mode 100644 index 0000000..043bb85 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeparticles/qdeclarativeparticles.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeparticles.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp new file mode 100644 index 0000000..6090a07 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeparticles/tst_qdeclarativeparticles.cpp @@ -0,0 +1,209 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> +#include <QtTest/QSignalSpy> +#include <qdeclarativeview.h> +#include <private/qdeclarativeparticles_p.h> + +class tst_QDeclarativeParticles : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeParticles(); + +private slots: + void properties(); + void motionGravity(); + void motionWander(); + void runs(); +private: + QDeclarativeView *createView(const QString &filename); + +}; + +tst_QDeclarativeParticles::tst_QDeclarativeParticles() +{ +} + +void tst_QDeclarativeParticles::properties() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/particles.qml"); + QVERIFY(canvas->rootObject()); + QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + QVERIFY(particles); + + particles->setSource(QUrl::fromLocalFile(SRCDIR "/data/particle.png")); + QCOMPARE(particles->source(), QUrl::fromLocalFile(SRCDIR "/data/particle.png")); + + particles->setLifeSpanDeviation(1000); + QCOMPARE(particles->lifeSpanDeviation(), 1000); + + particles->setFadeInDuration(1000); + QCOMPARE(particles->fadeInDuration(), 1000); + + particles->setFadeOutDuration(1000); + QCOMPARE(particles->fadeOutDuration(), 1000); + + particles->setAngle(100.0); + QCOMPARE(particles->angle(), 100.0); + + particles->setAngleDeviation(100.0); + QCOMPARE(particles->angleDeviation(), 100.0); + + particles->setVelocity(100.0); + QCOMPARE(particles->velocity(), 100.0); + + particles->setVelocityDeviation(100.0); + QCOMPARE(particles->velocityDeviation(), 100.0); + + particles->setEmissionVariance(0.5); + QCOMPARE(particles->emissionVariance(),0.5); + + particles->setEmissionRate(12); + QCOMPARE(particles->emissionRate(), 12); +} + +void tst_QDeclarativeParticles::motionGravity() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + QVERIFY(particles); + + QDeclarativeParticleMotionGravity* motionGravity = canvas->rootObject()->findChild<QDeclarativeParticleMotionGravity*>("motionGravity"); + QCOMPARE(particles->motion(), motionGravity); + + QSignalSpy xattractorSpy(motionGravity, SIGNAL(xattractorChanged())); + QSignalSpy yattractorSpy(motionGravity, SIGNAL(yattractorChanged())); + QSignalSpy accelerationSpy(motionGravity, SIGNAL(accelerationChanged())); + + QCOMPARE(motionGravity->xAttractor(), 0.0); + QCOMPARE(motionGravity->yAttractor(), 1000.0); + QCOMPARE(motionGravity->acceleration(), 25.0); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(motionGravity->xAttractor(), 20.0); + QCOMPARE(motionGravity->yAttractor(), 10.0); + QCOMPARE(motionGravity->acceleration(), 10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); + + motionGravity->setXAttractor(20.0); + motionGravity->setYAttractor(10.0); + motionGravity->setAcceleration(10.0); + + QCOMPARE(xattractorSpy.count(), 1); + QCOMPARE(yattractorSpy.count(), 1); + QCOMPARE(accelerationSpy.count(), 1); +} + +void tst_QDeclarativeParticles::motionWander() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/particlemotion.qml"); + QVERIFY(canvas->rootObject()); + QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + QVERIFY(particles); + + QSignalSpy motionSpy(particles, SIGNAL(motionChanged())); + QDeclarativeParticleMotionWander* motionWander = canvas->rootObject()->findChild<QDeclarativeParticleMotionWander*>("motionWander"); + + particles->setMotion(motionWander); + QCOMPARE(particles->motion(),motionWander); + QCOMPARE(motionSpy.count(), 1); + + particles->setMotion(motionWander); + QCOMPARE(motionSpy.count(), 1); + + QSignalSpy xvarianceSpy(motionWander, SIGNAL(xvarianceChanged())); + QSignalSpy yvarianceSpy(motionWander, SIGNAL(yvarianceChanged())); + QSignalSpy paceSpy(motionWander, SIGNAL(paceChanged())); + + QCOMPARE(motionWander->xVariance(), 30.0); + QCOMPARE(motionWander->yVariance(), 30.0); + QCOMPARE(motionWander->pace(), 100.0); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(motionWander->xVariance(), 20.0); + QCOMPARE(motionWander->yVariance(), 10.0); + QCOMPARE(motionWander->pace(), 10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); + + motionWander->setXVariance(20.0); + motionWander->setYVariance(10.0); + motionWander->setPace(10.0); + + QCOMPARE(xvarianceSpy.count(), 1); + QCOMPARE(yvarianceSpy.count(), 1); + QCOMPARE(paceSpy.count(), 1); +} + +void tst_QDeclarativeParticles::runs() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/particles.qml"); + QVERIFY(canvas->rootObject()); + QDeclarativeParticles* particles = canvas->rootObject()->findChild<QDeclarativeParticles*>("particles"); + QVERIFY(particles); + QTest::qWait(1000);//Run for one second. Test passes if it doesn't crash. +} + +QDeclarativeView *tst_QDeclarativeParticles::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + canvas->setSource(QUrl::fromLocalFile(filename)); + + return canvas; +} +QTEST_MAIN(tst_QDeclarativeParticles) + +#include "tst_qdeclarativeparticles.moc" diff --git a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml index 8d07db2..8d07db2 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/datamodel.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/datamodel.qml diff --git a/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml new file mode 100644 index 0000000..627f38a --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/data/displaypath.qml @@ -0,0 +1,60 @@ +import Qt 4.6 + +Rectangle { + width: 240 + height: 320 + color: "#ffffff" + resources: [ + Component { + id: delegate + Rectangle { + id: wrapper + objectName: "wrapper" + height: 20 + width: 60 + color: "white" + border.color: "black" + Text { + text: index + } + Text { + x: 20 + id: displayText + objectName: "displayText" + text: display + } + } + } + ] + PathView { + id: view + objectName: "view" + width: 240 + height: 320 + model: testModel + delegate: delegate + snapPosition: 0.01 + path: Path { + startY: 120 + startX: 160 + PathQuad { + y: 120 + x: 80 + controlY: 330 + controlX: 100 + } + PathLine { + y: 160 + x: 20 + } + PathCubic { + y: 120 + x: 160 + control1Y: 0 + control1X: 100 + control2Y: 000 + control2X: 200 + } + } + } +} diff --git a/tests/auto/declarative/qmlgraphicspathview/data/path.qml b/tests/auto/declarative/qdeclarativepathview/data/path.qml index 7e82a48..7e82a48 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/path.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/path.qml diff --git a/tests/auto/declarative/qmlgraphicspathview/data/pathview.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml index 8fa8d59..8fa8d59 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/pathview.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview.qml diff --git a/tests/auto/declarative/qmlgraphicspathview/data/pathview1.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml index b3b0a9a..b3b0a9a 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/pathview1.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview1.qml diff --git a/tests/auto/declarative/qmlgraphicspathview/data/pathview2.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml index 0d5c98b..0d5c98b 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/pathview2.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview2.qml diff --git a/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml index 412cca2..412cca2 100644 --- a/tests/auto/declarative/qmlgraphicspathview/data/pathview3.qml +++ b/tests/auto/declarative/qdeclarativepathview/data/pathview3.qml diff --git a/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro new file mode 100644 index 0000000..2f6ae32 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/qdeclarativepathview.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativepathview.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp new file mode 100644 index 0000000..79bc607 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepathview/tst_qdeclarativepathview.cpp @@ -0,0 +1,529 @@ +/**************************************************************************** +** +** 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 <private/qdeclarativepathview_p.h> +#include <private/qdeclarativepath_p.h> +#include <qdeclarativecontext.h> +#include <qdeclarativeexpression.h> +#include <qtest.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <QtDeclarative/private/qdeclarativetext_p.h> +#include <QtDeclarative/private/qdeclarativerectangle_p.h> +#include <QAbstractListModel> +#include <QStringListModel> +#include <QFile> +#include <private/qdeclarativevaluetype_p.h> +#include "../../../shared/util.h" + +class tst_QDeclarativePathView : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativePathView(); + +private slots: + void initValues(); + void items(); + void dataModel(); + void pathview2(); + void pathview3(); + void path(); + void pathMoved(); + void resetModel(); + +private: + QDeclarativeView *createView(); + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1); + template<typename T> + QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); +}; + +class TestObject : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool error READ error WRITE setError) + Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged) + Q_PROPERTY(int pathItemCount READ pathItemCount NOTIFY pathItemCountChanged) + +public: + TestObject() : QObject(), mError(true), mUseModel(true), mPathItemCount(-1) {} + + bool error() const { return mError; } + void setError(bool err) { mError = err; } + + bool useModel() const { return mUseModel; } + void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); } + + int pathItemCount() const { return mPathItemCount; } + void setPathItemCount(int count) { mPathItemCount = count; emit pathItemCountChanged(); } + +signals: + void useModelChanged(); + void pathItemCountChanged(); + +private: + bool mError; + bool mUseModel; + int mPathItemCount; +}; + +class TestModel : public QAbstractListModel +{ +public: + enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; + + TestModel(QObject *parent=0) : QAbstractListModel(parent) { + QHash<int, QByteArray> roles; + roles[Name] = "name"; + roles[Number] = "number"; + setRoleNames(roles); + } + + int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { + QVariant rv; + if (role == Name) + rv = list.at(index.row()).first; + else if (role == Number) + rv = list.at(index.row()).second; + + return rv; + } + + int count() const { return rowCount(); } + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + void addItem(const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()); + list.append(QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void insertItem(int index, const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), index, index); + list.insert(index, QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void removeItem(int index) { + emit beginRemoveRows(QModelIndex(), index, index); + list.removeAt(index); + emit endRemoveRows(); + } + + void moveItem(int from, int to) { + emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + list.move(from, to); + emit endMoveRows(); + } + + void modifyItem(int idx, const QString &name, const QString &number) { + list[idx] = QPair<QString,QString>(name, number); + emit dataChanged(index(idx,0), index(idx,0)); + } + +private: + QList<QPair<QString,QString> > list; +}; + + +tst_QDeclarativePathView::tst_QDeclarativePathView() +{ +} + +void tst_QDeclarativePathView::initValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview1.qml")); + QDeclarativePathView *obj = qobject_cast<QDeclarativePathView*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->path() == 0); + QVERIFY(obj->delegate() == 0); + QCOMPARE(obj->model(), QVariant()); + QCOMPARE(obj->currentIndex(), 0); + QCOMPARE(obj->offset(), 0.); + QCOMPARE(obj->snapPosition(), 0.); + QCOMPARE(obj->dragMargin(), 0.); + QCOMPARE(obj->count(), 0); + QCOMPARE(obj->pathItemCount(), -1); +} + +void tst_QDeclarativePathView::items() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + model.addItem("Fred", "12345"); + model.addItem("John", "2345"); + model.addItem("Bob", "54321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); + qApp->processEvents(); + + QDeclarativePathView *pathview = findItem<QDeclarativePathView>(canvas->rootObject(), "view"); + QVERIFY(pathview != 0); + + QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible + + for (int i = 0; i < model.count(); ++i) { + QDeclarativeText *name = findItem<QDeclarativeText>(pathview, "textName", i); + QVERIFY(name != 0); + QCOMPARE(name->text(), model.name(i)); + QDeclarativeText *number = findItem<QDeclarativeText>(pathview, "textNumber", i); + QVERIFY(number != 0); + QCOMPARE(number->text(), model.number(i)); + } + + delete canvas; +} + +void tst_QDeclarativePathView::pathview2() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview2.qml")); + QDeclarativePathView *obj = qobject_cast<QDeclarativePathView*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->path() != 0); + QVERIFY(obj->delegate() != 0); + QVERIFY(obj->model() != QVariant()); + QCOMPARE(obj->currentIndex(), 0); + QCOMPARE(obj->offset(), 0.); + QCOMPARE(obj->snapPosition(), 0.); + QCOMPARE(obj->dragMargin(), 0.); + QCOMPARE(obj->count(), 8); + QCOMPARE(obj->pathItemCount(), 10); +} + +void tst_QDeclarativePathView::pathview3() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview3.qml")); + QDeclarativePathView *obj = qobject_cast<QDeclarativePathView*>(c.create()); + + QVERIFY(obj != 0); + QVERIFY(obj->path() != 0); + QVERIFY(obj->delegate() != 0); + QVERIFY(obj->model() != QVariant()); + QCOMPARE(obj->currentIndex(), 0); + QCOMPARE(obj->offset(), 50.); // ??? + QCOMPARE(obj->snapPosition(), 0.5); // ??? + QCOMPARE(obj->dragMargin(), 24.); + QCOMPARE(obj->count(), 8); + QCOMPARE(obj->pathItemCount(), 4); +} + +void tst_QDeclarativePathView::path() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/path.qml")); + QDeclarativePath *obj = qobject_cast<QDeclarativePath*>(c.create()); + + QVERIFY(obj != 0); + QCOMPARE(obj->startX(), 120.); + QCOMPARE(obj->startY(), 100.); + QVERIFY(obj->path() != QPainterPath()); + + QDeclarativeListReference list(obj, "pathElements"); + QCOMPARE(list.count(), 5); + + QDeclarativePathAttribute* attr = qobject_cast<QDeclarativePathAttribute*>(list.at(0)); + QVERIFY(attr != 0); + QCOMPARE(attr->name(), QString("scale")); + QCOMPARE(attr->value(), 1.0); + + QDeclarativePathQuad* quad = qobject_cast<QDeclarativePathQuad*>(list.at(1)); + QVERIFY(quad != 0); + QCOMPARE(quad->x(), 120.); + QCOMPARE(quad->y(), 25.); + QCOMPARE(quad->controlX(), 260.); + QCOMPARE(quad->controlY(), 75.); + + QDeclarativePathPercent* perc = qobject_cast<QDeclarativePathPercent*>(list.at(2)); + QVERIFY(perc != 0); + QCOMPARE(perc->value(), 0.3); + + QDeclarativePathLine* line = qobject_cast<QDeclarativePathLine*>(list.at(3)); + QVERIFY(line != 0); + QCOMPARE(line->x(), 120.); + QCOMPARE(line->y(), 100.); + + QDeclarativePathCubic* cubic = qobject_cast<QDeclarativePathCubic*>(list.at(4)); + QVERIFY(cubic != 0); + QCOMPARE(cubic->x(), 180.); + QCOMPARE(cubic->y(), 0.); + QCOMPARE(cubic->control1X(), -10.); + QCOMPARE(cubic->control1Y(), 90.); + QCOMPARE(cubic->control2X(), 210.); + QCOMPARE(cubic->control2Y(), 90.); +} + +void tst_QDeclarativePathView::dataModel() +{ + QDeclarativeView *canvas = createView(); + + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + TestModel model; + model.addItem("red", "1"); + model.addItem("green", "2"); + model.addItem("blue", "3"); + model.addItem("purple", "4"); + model.addItem("gray", "5"); + model.addItem("brown", "6"); + model.addItem("yellow", "7"); + model.addItem("thistle", "8"); + model.addItem("cyan", "9"); + + ctxt->setContextProperty("testData", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/datamodel.qml")); + qApp->processEvents(); + + QDeclarativePathView *pathview = qobject_cast<QDeclarativePathView*>(canvas->rootObject()); + QVERIFY(pathview != 0); + + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + + QDeclarativeItem *item = findItem<QDeclarativeItem>(pathview, "wrapper", 0); + QVERIFY(item); + QCOMPARE(item->x(), 110.0); + QCOMPARE(item->y(), 10.0); + + model.insertItem(4, "orange", "10"); + + int itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); + QCOMPARE(itemCount, 10); + + QDeclarativeText *text = findItem<QDeclarativeText>(pathview, "myText", 4); + QVERIFY(text); + QCOMPARE(text->text(), model.name(4)); + + model.removeItem(2); + text = findItem<QDeclarativeText>(pathview, "myText", 2); + QVERIFY(text); + QCOMPARE(text->text(), model.name(2)); + + testObject->setPathItemCount(5); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + + itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); + QCOMPARE(itemCount, 5); + + QDeclarativeRectangle *testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 4); + QVERIFY(testItem != 0); + testItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 5); + QVERIFY(testItem == 0); + + model.insertItem(2, "pink", "2"); + + itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); + QCOMPARE(itemCount, 5); + + text = findItem<QDeclarativeText>(pathview, "myText", 2); + QVERIFY(text); + QCOMPARE(text->text(), model.name(2)); + + model.removeItem(3); + itemCount = findItems<QDeclarativeItem>(pathview, "wrapper").count(); + QCOMPARE(itemCount, 5); + text = findItem<QDeclarativeText>(pathview, "myText", 3); + QVERIFY(text); + QCOMPARE(text->text(), model.name(3)); + + delete canvas; +} + +void tst_QDeclarativePathView::pathMoved() +{ + QDeclarativeView *canvas = createView(); + + TestModel model; + model.addItem("Ben", "12345"); + model.addItem("Bohn", "2345"); + model.addItem("Bob", "54321"); + model.addItem("Bill", "4321"); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/pathview.qml")); + qApp->processEvents(); + + QDeclarativePathView *pathview = findItem<QDeclarativePathView>(canvas->rootObject(), "view"); + QVERIFY(pathview != 0); + + QDeclarativeRectangle *firstItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", 0); + QVERIFY(firstItem); + QDeclarativePath *path = qobject_cast<QDeclarativePath*>(pathview->path()); + QVERIFY(path); + QPointF start = path->pointAt(0.0); + QPointF offset;//Center of item is at point, but pos is from corner + offset.setX(firstItem->width()/2); + offset.setY(firstItem->height()/2); + QCOMPARE(firstItem->pos() + offset, start); + pathview->setOffset(10); + QTest::qWait(1000);//Moving is animated? + + for(int i=0; i<model.count(); i++){ + QDeclarativeRectangle *curItem = findItem<QDeclarativeRectangle>(pathview, "wrapper", i); + QCOMPARE(curItem->pos() + offset, path->pointAt(0.1 + i*0.25)); + } + + pathview->setOffset(100); + QTest::qWait(1000);//Moving is animated? + QCOMPARE(firstItem->pos() + offset, start); + + delete canvas; +} + +void tst_QDeclarativePathView::resetModel() +{ + QDeclarativeView *canvas = createView(); + + QStringList strings; + strings << "one" << "two" << "three"; + QStringListModel model(strings); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testModel", &model); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/displaypath.qml")); + qApp->processEvents(); + + QDeclarativePathView *pathview = findItem<QDeclarativePathView>(canvas->rootObject(), "view"); + QVERIFY(pathview != 0); + + QCOMPARE(pathview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(pathview, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } + + strings.clear(); + strings << "four" << "five" << "six" << "seven"; + model.setStringList(strings); + + QCOMPARE(pathview->count(), model.rowCount()); + + for (int i = 0; i < model.rowCount(); ++i) { + QDeclarativeText *display = findItem<QDeclarativeText>(pathview, "displayText", i); + QVERIFY(display != 0); + QCOMPARE(display->text(), strings.at(i)); + } +} + + +QDeclarativeView *tst_QDeclarativePathView::createView() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + return canvas; +} + +/* + Find an item with the specified objectName. If index is supplied then the + item must also evaluate the {index} expression equal to index + */ +template<typename T> +T *tst_QDeclarativePathView::findItem(QGraphicsObject *parent, const QString &objectName, int index) +{ + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->childItems().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { + if (index != -1) { + QDeclarativeExpression e(qmlContext(item), "index", item); + if (e.value().toInt() == index) + return static_cast<T*>(item); + } else { + return static_cast<T*>(item); + } + } + item = findItem<T>(item, objectName, index); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + +template<typename T> +QList<T*> tst_QDeclarativePathView::findItems(QGraphicsObject *parent, const QString &objectName) +{ + QList<T*> items; + const QMetaObject &mo = T::staticMetaObject; + //qDebug() << parent->QGraphicsObject::children().count() << "children"; + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *item = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if(!item) + continue; + //qDebug() << "try" << item; + if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) + items.append(static_cast<T*>(item)); + items += findItems<T>(item, objectName); + } + + return items; +} + +QTEST_MAIN(tst_QDeclarativePathView) + +#include "tst_qdeclarativepathview.moc" diff --git a/tests/auto/declarative/qmlimageprovider/data/exists.png b/tests/auto/declarative/qdeclarativepixmapcache/data/exists.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlimageprovider/data/exists.png +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/exists.png diff --git a/tests/auto/declarative/qmlimageprovider/data/exists1.png b/tests/auto/declarative/qdeclarativepixmapcache/data/exists1.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlimageprovider/data/exists1.png +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/exists1.png diff --git a/tests/auto/declarative/qmlimageprovider/data/exists2.png b/tests/auto/declarative/qdeclarativepixmapcache/data/exists2.png Binary files differindex 399bd0b..399bd0b 100644 --- a/tests/auto/declarative/qmlimageprovider/data/exists2.png +++ b/tests/auto/declarative/qdeclarativepixmapcache/data/exists2.png diff --git a/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro new file mode 100644 index 0000000..899c43f --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/qdeclarativepixmapcache.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativepixmapcache.cpp + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp new file mode 100644 index 0000000..223f54f --- /dev/null +++ b/tests/auto/declarative/qdeclarativepixmapcache/tst_qdeclarativepixmapcache.cpp @@ -0,0 +1,282 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> +#include <private/qdeclarativepixmapcache_p.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QNetworkReply> + +// These don't let normal people run tests! +//#include "../network-settings.h" + +class tst_qdeclarativepixmapcache : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativepixmapcache() : + thisfile(QUrl::fromLocalFile(__FILE__)) + { + } + +private slots: + void single(); + void single_data(); + void parallel(); + void parallel_data(); + +private: + QDeclarativeEngine engine; + QUrl thisfile; +}; + + +static int slotters=0; + +class Slotter : public QObject +{ + Q_OBJECT +public: + Slotter() + { + gotslot = false; + slotters++; + } + bool gotslot; + +public slots: + void got() + { + gotslot = true; + --slotters; + if (slotters==0) + QTestEventLoop::instance().exitLoop(); + } +}; + +#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML +static const bool localfile_optimized = true; +#else +static const bool localfile_optimized = false; +#endif + +void tst_qdeclarativepixmapcache::single_data() +{ + // Note, since QDeclarativePixmapCache is shared, tests affect each other! + // so use different files fore all test functions. + + QTest::addColumn<QUrl>("target"); + QTest::addColumn<bool>("incache"); + QTest::addColumn<bool>("exists"); + QTest::addColumn<bool>("neterror"); + + // File URLs are optimized + QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false; + QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false; + QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false; + QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true; +} + +void tst_qdeclarativepixmapcache::single() +{ + QFETCH(QUrl, target); + QFETCH(bool, incache); + QFETCH(bool, exists); + QFETCH(bool, neterror); + + if (neterror) { + QString expected = "\"Error downloading " + target.toString() + " - server replied: Not Found\" "; + QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); + } else if (!exists) { + QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) "; + QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); + } + + QPixmap pixmap; + QVERIFY(pixmap.width() <= 0); // Check Qt assumption + QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap); + + if (incache) { + if (exists) { + QVERIFY(status == QDeclarativePixmapReply::Ready); + QVERIFY(pixmap.width() > 0); + } else { + QVERIFY(status == QDeclarativePixmapReply::Error); + QVERIFY(pixmap.width() <= 0); + } + } else { + QDeclarativePixmapReply *reply = QDeclarativePixmapCache::request(&engine, target); + QVERIFY(reply); + QVERIFY(pixmap.width() <= 0); + + Slotter getter; + connect(reply, SIGNAL(finished()), &getter, SLOT(got())); + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + QVERIFY(getter.gotslot); + if (exists) { + QVERIFY(QDeclarativePixmapCache::get(target, &pixmap) == QDeclarativePixmapReply::Ready); + QVERIFY(pixmap.width() > 0); + } else { + QVERIFY(QDeclarativePixmapCache::get(target, &pixmap) == QDeclarativePixmapReply::Error); + QVERIFY(pixmap.width() <= 0); + } + } + + QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0); +} + +void tst_qdeclarativepixmapcache::parallel_data() +{ + // Note, since QDeclarativePixmapCache is shared, tests affect each other! + // so use different files fore all test functions. + + QTest::addColumn<QUrl>("target1"); + QTest::addColumn<QUrl>("target2"); + QTest::addColumn<int>("incache"); + QTest::addColumn<int>("cancel"); // which one to cancel + QTest::addColumn<int>("requests"); + + QTest::newRow("local") + << thisfile.resolved(QUrl("data/exists1.png")) + << thisfile.resolved(QUrl("data/exists2.png")) + << (localfile_optimized ? 2 : 0) + << -1 + << (localfile_optimized ? 0 : 2) + ; + + QTest::newRow("remote") + << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") + << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << 0 + << -1 + << 2 + ; + + QTest::newRow("remoteagain") + << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") + << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") + << 2 + << -1 + << 0 + ; + + QTest::newRow("remotecopy") + << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") + << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") + << 0 + << -1 + << 1 + ; + + QTest::newRow("remotecopycancel") + << QUrl("http://qt.nokia.com/rounded_block_bg.png") + << QUrl("http://qt.nokia.com/rounded_block_bg.png") + << 0 + << 0 + << 1 + ; +} + +void tst_qdeclarativepixmapcache::parallel() +{ + QFETCH(QUrl, target1); + QFETCH(QUrl, target2); + QFETCH(int, incache); + QFETCH(int, cancel); + QFETCH(int, requests); + + QList<QUrl> targets; + targets << target1 << target2; + + QList<QDeclarativePixmapReply*> replies; + QList<Slotter*> getters; + for (int i=0; i<targets.count(); ++i) { + QUrl target = targets.at(i); + QPixmap pixmap; + QDeclarativePixmapReply::Status status = QDeclarativePixmapCache::get(target, &pixmap); + QDeclarativePixmapReply *reply = 0; + if (status != QDeclarativePixmapReply::Error && status != QDeclarativePixmapReply::Ready) + reply = QDeclarativePixmapCache::request(&engine, target); + replies.append(reply); + if (!reply) { + QVERIFY(pixmap.width() > 0); + getters.append(0); + } else { + QVERIFY(pixmap.width() <= 0); + getters.append(new Slotter); + connect(reply, SIGNAL(finished()), getters[i], SLOT(got())); + } + } + + QCOMPARE(incache+slotters, targets.count()); + QCOMPARE(QDeclarativePixmapCache::pendingRequests(), requests); + + if (cancel >= 0) { + QDeclarativePixmapCache::cancel(targets.at(cancel), getters[cancel]); + slotters--; + } + + if (slotters) { + QTestEventLoop::instance().enterLoop(10); + QVERIFY(!QTestEventLoop::instance().timeout()); + } + + for (int i=0; i<targets.count(); ++i) { + QDeclarativePixmapReply *reply = replies[i]; + if (reply) { + if (i == cancel) { + QVERIFY(!getters[i]->gotslot); + } else { + QVERIFY(getters[i]->gotslot); + QPixmap pixmap; + QVERIFY(QDeclarativePixmapCache::get(targets[i], &pixmap) == QDeclarativePixmapReply::Ready); + QVERIFY(pixmap.width() > 0); + } + delete getters[i]; + } + } + + QCOMPARE(QDeclarativePixmapCache::pendingRequests(), 0); +} + +QTEST_MAIN(tst_qdeclarativepixmapcache) + +#include "tst_qdeclarativepixmapcache.moc" diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml index f6376a1..f6376a1 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/grid-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-animated.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/grid-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml index 5b4a30d..5b4a30d 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/grid-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid-spacing.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/grid.qml b/tests/auto/declarative/qdeclarativepositioners/data/grid.qml index 830df6a..830df6a 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/grid.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/grid.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml index c113a36..c113a36 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-animated.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml index 32bf775..32bf775 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal-spacing.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal.qml b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml index 06ae151..06ae151 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/horizontal.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/horizontal.qml diff --git a/tests/auto/declarative/qdeclarativepositioners/data/propertychanges.qml b/tests/auto/declarative/qdeclarativepositioners/data/propertychanges.qml new file mode 100644 index 0000000..4370a18 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/data/propertychanges.qml @@ -0,0 +1,39 @@ +import Qt 4.6 + +Grid { + id: myGrid + + width: 270 + height: 270 + x: 3 + y: 3 + columns: 4 + spacing: 3 + + add: columnTransition + move: columnTransition + + Repeater { + model: 20 + Rectangle { color: "black"; width: 50; height: 50 } + } + + data: [ + Transition { + id: rowTransition + objectName: "rowTransition" + NumberAnimation { + properties: "x,y"; + easing.type: "OutInCubic" + } + }, + Transition { + id: columnTransition + objectName: "columnTransition" + NumberAnimation { + properties: "x,y"; + easing.type: "OutInCubic" + } + } + ] +} diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/repeater.qml b/tests/auto/declarative/qdeclarativepositioners/data/repeater.qml index 2bc5e94..2bc5e94 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/repeater.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/repeater.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml index 10f6cbb..10f6cbb 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-animated.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-animated.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-spacing.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml index 69a8256..69a8256 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/vertical-spacing.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical-spacing.qml diff --git a/tests/auto/declarative/qmlgraphicspositioners/data/vertical.qml b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml index 856c180..856c180 100644 --- a/tests/auto/declarative/qmlgraphicspositioners/data/vertical.qml +++ b/tests/auto/declarative/qdeclarativepositioners/data/vertical.qml diff --git a/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro new file mode 100644 index 0000000..5edfa55 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/qdeclarativepositioners.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativepositioners.cpp +macx:CONFIG -= app_bundle + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp new file mode 100644 index 0000000..3a8a892 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepositioners/tst_qdeclarativepositioners.cpp @@ -0,0 +1,455 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> +#include <private/qlistmodelinterface_p.h> +#include <qdeclarativeview.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativepositioners_p.h> +#include <private/qdeclarativetransition_p.h> +#include <qdeclarativeexpression.h> +#include "../../../shared/util.h" + +class tst_QDeclarativePositioners : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativePositioners(); + +private slots: + void test_horizontal(); + void test_horizontal_spacing(); + void test_horizontal_animated(); + void test_vertical(); + void test_vertical_spacing(); + void test_vertical_animated(); + void test_grid(); + void test_grid_spacing(); + void test_grid_animated(); + void test_propertychanges(); + void test_repeater(); +private: + QDeclarativeView *createView(const QString &filename); +}; + +tst_QDeclarativePositioners::tst_QDeclarativePositioners() +{ +} + +void tst_QDeclarativePositioners::test_horizontal() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 70.0); + QCOMPARE(three->y(), 0.0); +} + +void tst_QDeclarativePositioners::test_horizontal_spacing() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 60.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 90.0); + QCOMPARE(three->y(), 0.0); +} + +void tst_QDeclarativePositioners::test_horizontal_animated() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + //Note that they animate in + QCOMPARE(one->x(), -100.0); + QCOMPARE(two->x(), -100.0); + QCOMPARE(three->x(), -100.0); + + //QTRY_COMPARE used instead of waiting for the expected time of animation completion + //Note that this means the duration of the animation is NOT tested + + QTRY_COMPARE(one->x(), 0.0); + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(two->opacity(), 0.0); + QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet + QTRY_COMPARE(two->y(), 0.0); + QTRY_COMPARE(three->x(), 50.0); + QTRY_COMPARE(three->y(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->x(), -100.0); + QCOMPARE(three->x(), 50.0); + + QTRY_COMPARE(two->x(), 50.0); + QTRY_COMPARE(three->x(), 100.0); +} + +void tst_QDeclarativePositioners::test_vertical() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/vertical.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 50.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 60.0); +} + +void tst_QDeclarativePositioners::test_vertical_spacing() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 0.0); + QCOMPARE(two->y(), 60.0); + QCOMPARE(three->x(), 0.0); + QCOMPARE(three->y(), 80.0); +} + +void tst_QDeclarativePositioners::test_vertical_animated() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); + + //Note that they animate in + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QCOMPARE(one->y(), -100.0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QCOMPARE(two->y(), -100.0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QCOMPARE(three->y(), -100.0); + + //QTRY_COMPARE used instead of waiting for the expected time of animation completion + //Note that this means the duration of the animation is NOT tested + + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(one->x(), 0.0); + QTRY_COMPARE(two->opacity(), 0.0); + QTRY_COMPARE(two->y(), -100.0);//Not 'in' yet + QTRY_COMPARE(two->x(), 0.0); + QTRY_COMPARE(three->y(), 50.0); + QTRY_COMPARE(three->x(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QTRY_COMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->y(), -100.0); + QCOMPARE(three->y(), 50.0); + + QTRY_COMPARE(two->y(), 50.0); + QTRY_COMPARE(three->y(), 100.0); + +} + +void tst_QDeclarativePositioners::test_grid() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 70.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 50.0); + QCOMPARE(five->x(), 50.0); + QCOMPARE(five->y(), 50.0); +} + +void tst_QDeclarativePositioners::test_grid_spacing() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid-spacing.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 54.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 78.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 0.0); + QCOMPARE(four->y(), 54.0); + QCOMPARE(five->x(), 54.0); + QCOMPARE(five->y(), 54.0); +} + +void tst_QDeclarativePositioners::test_grid_animated() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/grid-animated.qml"); + + //Note that all animate in + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + QCOMPARE(one->x(), -100.0); + QCOMPARE(one->y(), -100.0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + QCOMPARE(two->x(), -100.0); + QCOMPARE(two->y(), -100.0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + QCOMPARE(three->x(), -100.0); + QCOMPARE(three->y(), -100.0); + + QDeclarativeRectangle *four = canvas->rootObject()->findChild<QDeclarativeRectangle*>("four"); + QVERIFY(four != 0); + QCOMPARE(four->x(), -100.0); + QCOMPARE(four->y(), -100.0); + + QDeclarativeRectangle *five = canvas->rootObject()->findChild<QDeclarativeRectangle*>("five"); + QVERIFY(five != 0); + QCOMPARE(five->x(), -100.0); + QCOMPARE(five->y(), -100.0); + + //QTRY_COMPARE used instead of waiting for the expected time of animation completion + //Note that this means the duration of the animation is NOT tested + + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(one->x(), 0.0); + QTRY_COMPARE(two->opacity(), 0.0); + QTRY_COMPARE(two->y(), -100.0); + QTRY_COMPARE(two->x(), -100.0); + QTRY_COMPARE(three->y(), 0.0); + QTRY_COMPARE(three->x(), 50.0); + QTRY_COMPARE(four->y(), 0.0); + QTRY_COMPARE(four->x(), 100.0); + QTRY_COMPARE(five->y(), 50.0); + QTRY_COMPARE(five->x(), 0.0); + + //Add 'two' + two->setOpacity(1.0); + QCOMPARE(two->opacity(), 1.0); + QTest::qWait(0);//Let the animation start + QCOMPARE(two->x(), -100.0); + QCOMPARE(two->y(), -100.0); + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(three->x(), 50.0); + QCOMPARE(three->y(), 0.0); + QCOMPARE(four->x(), 100.0); + QCOMPARE(four->y(), 0.0); + QCOMPARE(five->x(), 0.0); + QCOMPARE(five->y(), 50.0); + //Let the animation complete + QTRY_COMPARE(two->x(), 50.0); + QTRY_COMPARE(two->y(), 0.0); + QTRY_COMPARE(one->x(), 0.0); + QTRY_COMPARE(one->y(), 0.0); + QTRY_COMPARE(three->x(), 100.0); + QTRY_COMPARE(three->y(), 0.0); + QTRY_COMPARE(four->x(), 0.0); + QTRY_COMPARE(four->y(), 50.0); + QTRY_COMPARE(five->x(), 50.0); + QTRY_COMPARE(five->y(), 50.0); + +} +void tst_QDeclarativePositioners::test_propertychanges() +{ + QDeclarativeView *canvas = createView("data/propertychanges.qml"); + + QDeclarativeGrid *grid = qobject_cast<QDeclarativeGrid*>(canvas->rootObject()); + QDeclarativeTransition *rowTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("rowTransition"); + QDeclarativeTransition *columnTransition = canvas->rootObject()->findChild<QDeclarativeTransition*>("columnTransition"); + + QSignalSpy addSpy(grid, SIGNAL(addChanged())); + QSignalSpy moveSpy(grid, SIGNAL(moveChanged())); + QSignalSpy columnsSpy(grid, SIGNAL(columnsChanged())); + QSignalSpy rowsSpy(grid, SIGNAL(rowsChanged())); + + QVERIFY(grid); + QVERIFY(rowTransition); + QVERIFY(columnTransition); + QCOMPARE(grid->add(), columnTransition); + QCOMPARE(grid->move(), columnTransition); + QCOMPARE(grid->columns(), 4); + QCOMPARE(grid->rows(), -1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(grid->add(), rowTransition); + QCOMPARE(grid->move(), rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(rowTransition); + grid->setMove(rowTransition); + QCOMPARE(addSpy.count(),1); + QCOMPARE(moveSpy.count(),1); + + grid->setAdd(0); + grid->setMove(0); + QCOMPARE(addSpy.count(),2); + QCOMPARE(moveSpy.count(),2); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(grid->columns(), -1); + QCOMPARE(grid->rows(), 3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(-1); + grid->setRows(3); + QCOMPARE(columnsSpy.count(),1); + QCOMPARE(rowsSpy.count(),1); + + grid->setColumns(2); + grid->setRows(2); + QCOMPARE(columnsSpy.count(),2); + QCOMPARE(rowsSpy.count(),2); +} + +void tst_QDeclarativePositioners::test_repeater() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/repeater.qml"); + + QDeclarativeRectangle *one = canvas->rootObject()->findChild<QDeclarativeRectangle*>("one"); + QVERIFY(one != 0); + + QDeclarativeRectangle *two = canvas->rootObject()->findChild<QDeclarativeRectangle*>("two"); + QVERIFY(two != 0); + + QDeclarativeRectangle *three = canvas->rootObject()->findChild<QDeclarativeRectangle*>("three"); + QVERIFY(three != 0); + + QCOMPARE(one->x(), 0.0); + QCOMPARE(one->y(), 0.0); + QCOMPARE(two->x(), 50.0); + QCOMPARE(two->y(), 0.0); + QCOMPARE(three->x(), 100.0); + QCOMPARE(three->y(), 0.0); +} + +QDeclarativeView *tst_QDeclarativePositioners::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + + canvas->setSource(QUrl::fromLocalFile(filename)); + + return canvas; +} + + +QTEST_MAIN(tst_QDeclarativePositioners) + +#include "tst_qdeclarativepositioners.moc" diff --git a/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro new file mode 100644 index 0000000..22e50cc --- /dev/null +++ b/tests/auto/declarative/qdeclarativeproperty/qdeclarativeproperty.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativeproperty.cpp diff --git a/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp new file mode 100644 index 0000000..0333d98 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeproperty/tst_qdeclarativeproperty.cpp @@ -0,0 +1,1322 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <QtDeclarative/qdeclarativeproperty.h> +#include <QtDeclarative/private/qdeclarativeproperty_p.h> +#include <private/qguard_p.h> +#include <private/qdeclarativebinding_p.h> +#include <QtGui/QLineEdit> + +class MyQmlObject : public QObject +{ + Q_OBJECT +public: + MyQmlObject() {} +}; + +QML_DECLARE_TYPE(MyQmlObject); + +class MyAttached : public QObject +{ + Q_OBJECT + Q_PROPERTY(int foo READ foo WRITE setFoo) +public: + MyAttached(QObject *parent) : QObject(parent), m_foo(13) {} + + int foo() const { return m_foo; } + void setFoo(int f) { m_foo = f; } + +private: + int m_foo; +}; + +class MyContainer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeListProperty<MyQmlObject> children READ children) +public: + MyContainer() {} + + QDeclarativeListProperty<MyQmlObject> children() { return QDeclarativeListProperty<MyQmlObject>(this, m_children); } + + static MyAttached *qmlAttachedProperties(QObject *o) { + return new MyAttached(o); + } + +private: + QList<MyQmlObject*> m_children; +}; + +QML_DECLARE_TYPE(MyContainer); +QML_DECLARE_TYPEINFO(MyContainer, QML_HAS_ATTACHED_PROPERTIES) + +class tst_qdeclarativeproperty : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeproperty() {} + +private slots: + void initTestCase(); + + // Constructors + void qmlmetaproperty(); + void qmlmetaproperty_object(); + void qmlmetaproperty_object_string(); + void qmlmetaproperty_object_context(); + void qmlmetaproperty_object_string_context(); + + // Methods + void name(); + void read(); + void write(); + void reset(); + + // Functionality + void writeObjectToList(); + void writeListToList(); + + //writeToReadOnly(); + + // Bugs + void crashOnValueProperty(); + + void copy(); +private: + QDeclarativeEngine engine; +}; + +void tst_qdeclarativeproperty::qmlmetaproperty() +{ + QDeclarativeProperty prop; + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString()); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), false); + QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QVERIFY(prop.property().name() == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; +} + +class PropertyObject : public QObject +{ + Q_OBJECT + Q_PROPERTY(int defaultProperty READ defaultProperty); + Q_PROPERTY(QRect rectProperty READ rectProperty); + Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty); + 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_CLASSINFO("DefaultProperty", "defaultProperty"); +public: + PropertyObject() : m_resetProperty(9) {} + + int defaultProperty() { return 10; } + QRect rectProperty() { return QRect(10, 10, 1, 209); } + + QRect wrectProperty() { return m_rect; } + void setWRectProperty(const QRect &r) { m_rect = r; } + + QUrl url() { return m_url; } + void setUrl(const QUrl &u) { m_url = u; } + + int resettableProperty() const { return m_resetProperty; } + void setResettableProperty(int r) { m_resetProperty = r; } + void resetProperty() { m_resetProperty = 9; } + + int propertyWithNotify() const { return m_propertyWithNotify; } + void setPropertyWithNotify(int i) { m_propertyWithNotify = i; emit oddlyNamedNotifySignal(); } + +signals: + void clicked(); + void oddlyNamedNotifySignal(); + +private: + int m_resetProperty; + QRect m_rect; + QUrl m_url; + int m_propertyWithNotify; +}; + +QML_DECLARE_TYPE(PropertyObject); + +void tst_qdeclarativeproperty::qmlmetaproperty_object() +{ + QObject object; // Has no default property + PropertyObject dobject; // Has default property + + { + QDeclarativeProperty prop(&object); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString()); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), false); + QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QVERIFY(prop.property().name() == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("defaultProperty")); + QCOMPARE(prop.read(), QVariant(10)); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); + QCOMPARE(prop.isProperty(), true); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), true); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(prop.propertyType(), (int)QVariant::Int); + QCOMPARE(prop.propertyTypeName(), "int"); + QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding != 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } +} + +void tst_qdeclarativeproperty::qmlmetaproperty_object_string() +{ + QObject object; + PropertyObject dobject; + + { + QDeclarativeProperty prop(&object, QString("defaultProperty")); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString()); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), false); + QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QVERIFY(prop.property().name() == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("defaultProperty")); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("defaultProperty")); + QCOMPARE(prop.read(), QVariant(10)); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); + QCOMPARE(prop.isProperty(), true); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), true); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(prop.propertyType(), (int)QVariant::Int); + QCOMPARE(prop.propertyTypeName(), "int"); + QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding != 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("onClicked")); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("onClicked")); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant("Hello")), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QCOMPARE(QString(prop.method().signature()), QString("clicked()")); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.property().name(), (const char *)0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression != 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged")); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal")); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant("Hello")), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.property().name(), (const char *)0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression != 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } +} + +void tst_qdeclarativeproperty::qmlmetaproperty_object_context() +{ + QObject object; // Has no default property + PropertyObject dobject; // Has default property + + { + QDeclarativeProperty prop(&object, engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString()); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), false); + QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QVERIFY(prop.property().name() == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("defaultProperty")); + QCOMPARE(prop.read(), QVariant(10)); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); + QCOMPARE(prop.isProperty(), true); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), true); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(prop.propertyType(), (int)QVariant::Int); + QCOMPARE(prop.propertyTypeName(), "int"); + QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding != 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } +} + +void tst_qdeclarativeproperty::qmlmetaproperty_object_string_context() +{ + QObject object; + PropertyObject dobject; + + { + QDeclarativeProperty prop(&object, QString("defaultProperty"), engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString()); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Invalid); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), false); + QCOMPARE(prop.object(), (QObject *)0); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QVERIFY(prop.property().name() == 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), -1); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("defaultProperty")); + QCOMPARE(prop.read(), QVariant(10)); + QCOMPARE(prop.write(QVariant()), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), true); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QVERIFY(prop.method().signature() == 0); + QCOMPARE(prop.type(), QDeclarativeProperty::Property); + QCOMPARE(prop.isProperty(), true); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), true); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(prop.propertyType(), (int)QVariant::Int); + QCOMPARE(prop.propertyTypeName(), "int"); + QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding != 0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == binding); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression == 0); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfProperty("defaultProperty")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("onClicked"), engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("onClicked")); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant("Hello")), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QCOMPARE(QString(prop.method().signature()), QString("clicked()")); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.property().name(), (const char *)0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression != 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("clicked()")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } + + { + QDeclarativeProperty prop(&dobject, QString("onPropertyWithNotifyChanged"), engine.rootContext()); + + QGuard<QDeclarativeBinding> binding(new QDeclarativeBinding(QLatin1String("null"), 0, engine.rootContext())); + binding->setTarget(prop); + QVERIFY(binding != 0); + QGuard<QDeclarativeExpression> expression(new QDeclarativeExpression()); + QVERIFY(expression != 0); + + QObject *obj = new QObject; + + QCOMPARE(prop.name(), QString("onOddlyNamedNotifySignal")); + QCOMPARE(prop.read(), QVariant()); + QCOMPARE(prop.write(QVariant("Hello")), false); + QCOMPARE(prop.hasNotifySignal(), false); + QCOMPARE(prop.needsNotifySignal(), false); + QCOMPARE(prop.connectNotifySignal(0, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, SLOT(deleteLater())), false); + QCOMPARE(prop.connectNotifySignal(obj, 0), false); + QCOMPARE(prop.connectNotifySignal(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); + QCOMPARE(prop.connectNotifySignal(obj, -1), false); + QCOMPARE(QString(prop.method().signature()), QString("oddlyNamedNotifySignal()")); + QCOMPARE(prop.type(), QDeclarativeProperty::SignalProperty); + QCOMPARE(prop.isProperty(), false); + QCOMPARE(prop.isWritable(), false); + QCOMPARE(prop.isDesignable(), false); + QCOMPARE(prop.isResettable(), false); + QCOMPARE(prop.isValid(), true); + QCOMPARE(prop.object(), &dobject); + QCOMPARE(prop.propertyTypeCategory(), QDeclarativeProperty::InvalidCategory); + QCOMPARE(prop.propertyType(), 0); + QCOMPARE(prop.propertyTypeName(), (const char *)0); + QCOMPARE(prop.property().name(), (const char *)0); + QVERIFY(QDeclarativePropertyPrivate::binding(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setBinding(prop, binding) == 0); + QVERIFY(binding == 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == 0); + QVERIFY(QDeclarativePropertyPrivate::setSignalExpression(prop, expression) == 0); + QVERIFY(expression != 0); + QVERIFY(QDeclarativePropertyPrivate::signalExpression(prop) == expression); + QCOMPARE(prop.index(), dobject.metaObject()->indexOfMethod("oddlyNamedNotifySignal()")); + QCOMPARE(QDeclarativePropertyPrivate::valueTypeCoreIndex(prop), -1); + + delete obj; + } +} + +void tst_qdeclarativeproperty::name() +{ + { + QDeclarativeProperty p; + QCOMPARE(p.name(), QString()); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.name(), QString("defaultProperty")); + } + + { + QObject o; + QDeclarativeProperty p(&o, QString("objectName")); + QCOMPARE(p.name(), QString("objectName")); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "onClicked"); + QCOMPARE(p.name(), QString("onClicked")); + } + + { + QObject o; + QDeclarativeProperty p(&o, "onClicked"); + QCOMPARE(p.name(), QString()); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); + QCOMPARE(p.name(), QString("onOddlyNamedNotifySignal")); + } + + { + QObject o; + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); + QCOMPARE(p.name(), QString()); + } + + { + QObject o; + QDeclarativeProperty p(&o, "foo"); + QCOMPARE(p.name(), QString()); + } + + { + QDeclarativeProperty p(0, "foo"); + QCOMPARE(p.name(), QString()); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "rectProperty"); + QCOMPARE(p.name(), QString("rectProperty")); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "rectProperty.x"); + QCOMPARE(p.name(), QString("rectProperty.x")); + } + + { + PropertyObject o; + QDeclarativeProperty p(&o, "rectProperty.foo"); + QCOMPARE(p.name(), QString()); + } +} + +void tst_qdeclarativeproperty::read() +{ + // Invalid + { + QDeclarativeProperty p; + QCOMPARE(p.read(), QVariant()); + } + + // Default prop + { + PropertyObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.read(), QVariant(10)); + } + + // Invalid default prop + { + QObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.read(), QVariant()); + } + + // Value prop by name + { + QObject o; + + QDeclarativeProperty p(&o, "objectName"); + QCOMPARE(p.read(), QVariant(QString())); + + o.setObjectName("myName"); + + QCOMPARE(p.read(), QVariant("myName")); + } + + // Value-type prop + { + PropertyObject o; + QDeclarativeProperty p(&o, "rectProperty.x"); + QCOMPARE(p.read(), QVariant(10)); + } + + // Invalid value-type prop + { + PropertyObject o; + QDeclarativeProperty p(&o, "rectProperty.foo"); + QCOMPARE(p.read(), QVariant()); + } + + // Signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onClicked"); + QCOMPARE(p.read(), QVariant()); + + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + + QCOMPARE(p.read(), QVariant()); + } + + // Automatic signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); + QCOMPARE(p.read(), QVariant()); + + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + + QCOMPARE(p.read(), QVariant()); + } + + // Deleted object + { + PropertyObject *o = new PropertyObject; + QDeclarativeProperty p(o, "rectProperty.x"); + QCOMPARE(p.read(), QVariant(10)); + delete o; + QCOMPARE(p.read(), QVariant()); + } + + // Attached property + { + QDeclarativeComponent component(&engine); + component.setData("import Test 1.0\nMyContainer { }", QUrl()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "MyContainer.foo", qmlContext(object)); + QCOMPARE(p.read(), QVariant(13)); + delete object; + } + { + QDeclarativeComponent component(&engine); + component.setData("import Test 1.0\nMyContainer { MyContainer.foo: 10 }", QUrl()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "MyContainer.foo", qmlContext(object)); + QCOMPARE(p.read(), QVariant(10)); + delete object; + } + { + QDeclarativeComponent component(&engine); + component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); + QCOMPARE(p.read(), QVariant(10)); + delete object; + } +} + +void tst_qdeclarativeproperty::write() +{ + // Invalid + { + QDeclarativeProperty p; + QCOMPARE(p.write(QVariant(10)), false); + } + + // Read-only default prop + { + PropertyObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.write(QVariant(10)), false); + } + + // Invalid default prop + { + QObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.write(QVariant(10)), false); + } + + // Read-only prop by name + { + PropertyObject o; + QDeclarativeProperty p(&o, QString("defaultProperty")); + QCOMPARE(p.write(QVariant(10)), false); + } + + // Writable prop by name + { + PropertyObject o; + QDeclarativeProperty p(&o, QString("objectName")); + QCOMPARE(o.objectName(), QString()); + QCOMPARE(p.write(QVariant(QString("myName"))), true); + QCOMPARE(o.objectName(), QString("myName")); + } + + // Deleted object + { + PropertyObject *o = new PropertyObject; + QDeclarativeProperty p(o, QString("objectName")); + QCOMPARE(p.write(QVariant(QString("myName"))), true); + QCOMPARE(o->objectName(), QString("myName")); + + delete o; + + QCOMPARE(p.write(QVariant(QString("myName"))), false); + } + + // Signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onClicked"); + QCOMPARE(p.write(QVariant("console.log(1921)")), false); + + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + + QCOMPARE(p.write(QVariant("console.log(1921)")), false); + + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + } + + // Automatic signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); + QCOMPARE(p.write(QVariant("console.log(1921)")), false); + + QVERIFY(0 == QDeclarativePropertyPrivate::setSignalExpression(p, new QDeclarativeExpression())); + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + + QCOMPARE(p.write(QVariant("console.log(1921)")), false); + + QVERIFY(0 != QDeclarativePropertyPrivate::signalExpression(p)); + } + + // Value-type property + { + PropertyObject o; + QDeclarativeProperty p(&o, "wrectProperty"); + + QCOMPARE(o.wrectProperty(), QRect()); + QCOMPARE(p.write(QRect(1, 13, 99, 8)), true); + QCOMPARE(o.wrectProperty(), QRect(1, 13, 99, 8)); + + QDeclarativeProperty p2(&o, "wrectProperty.x"); + QCOMPARE(p2.read(), QVariant(1)); + QCOMPARE(p2.write(QVariant(6)), true); + QCOMPARE(p2.read(), QVariant(6)); + QCOMPARE(o.wrectProperty(), QRect(6, 13, 99, 8)); + } + + // URL-property + { + PropertyObject o; + QDeclarativeProperty p(&o, "url"); + + QCOMPARE(p.write(QUrl("main.qml")), true); + QCOMPARE(o.url(), QUrl("main.qml")); + + QDeclarativeProperty p2(&o, "url", engine.rootContext()); + + QUrl result = engine.baseUrl().resolved(QUrl("main.qml")); + QVERIFY(result != QUrl("main.qml")); + + QCOMPARE(p2.write(QUrl("main.qml")), true); + QCOMPARE(o.url(), result); + } + + // Attached property + { + QDeclarativeComponent component(&engine); + component.setData("import Test 1.0\nMyContainer { }", QUrl()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "MyContainer.foo", qmlContext(object)); + p.write(QVariant(99)); + QCOMPARE(p.read(), QVariant(99)); + delete object; + } + { + QDeclarativeComponent component(&engine); + component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); + QObject *object = component.create(); + QVERIFY(object != 0); + + QDeclarativeProperty p(object, "Foo.MyContainer.foo", qmlContext(object)); + p.write(QVariant(99)); + QCOMPARE(p.read(), QVariant(99)); + delete object; + } +} + +void tst_qdeclarativeproperty::reset() +{ + // Invalid + { + QDeclarativeProperty p; + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Read-only default prop + { + PropertyObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Invalid default prop + { + QObject o; + QDeclarativeProperty p(&o); + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Non-resettable-only prop by name + { + PropertyObject o; + QDeclarativeProperty p(&o, QString("defaultProperty")); + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Resettable prop by name + { + PropertyObject o; + QDeclarativeProperty p(&o, QString("resettableProperty")); + + QCOMPARE(p.read(), QVariant(9)); + QCOMPARE(p.write(QVariant(11)), true); + QCOMPARE(p.read(), QVariant(11)); + + QCOMPARE(p.isResettable(), true); + QCOMPARE(p.reset(), true); + + QCOMPARE(p.read(), QVariant(9)); + } + + // Deleted object + { + PropertyObject *o = new PropertyObject; + + QDeclarativeProperty p(o, QString("resettableProperty")); + + QCOMPARE(p.isResettable(), true); + QCOMPARE(p.reset(), true); + + delete o; + + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onClicked"); + + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } + + // Automatic signal property + { + PropertyObject o; + QDeclarativeProperty p(&o, "onPropertyWithNotifyChanged"); + + QCOMPARE(p.isResettable(), false); + QCOMPARE(p.reset(), false); + } +} + +void tst_qdeclarativeproperty::writeObjectToList() +{ + QDeclarativeComponent containerComponent(&engine); + containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); + MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); + QVERIFY(container != 0); + QDeclarativeListReference list(container, "children"); + QVERIFY(list.count() == 1); + + MyQmlObject *object = new MyQmlObject; + QDeclarativeProperty prop(container, "children"); + prop.write(qVariantFromValue(object)); + QCOMPARE(list.count(), 1); + QCOMPARE(list.at(0), object); +} + +Q_DECLARE_METATYPE(QList<QObject *>); +void tst_qdeclarativeproperty::writeListToList() +{ + QDeclarativeComponent containerComponent(&engine); + containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); + MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); + QVERIFY(container != 0); + QDeclarativeListReference list(container, "children"); + QVERIFY(list.count() == 1); + + QList<QObject*> objList; + objList << new MyQmlObject() << new MyQmlObject() << new MyQmlObject() << new MyQmlObject(); + QDeclarativeProperty prop(container, "children"); + prop.write(qVariantFromValue(objList)); + QCOMPARE(list.count(), 4); + + //XXX need to try this with read/write prop (for read-only it correctly doesn't write) + /*QList<MyQmlObject*> typedObjList; + typedObjList << new MyQmlObject(); + prop.write(qVariantFromValue(&typedObjList)); + QCOMPARE(container->children()->size(), 1);*/ +} + +void tst_qdeclarativeproperty::crashOnValueProperty() +{ + QDeclarativeEngine *engine = new QDeclarativeEngine; + QDeclarativeComponent component(engine); + + component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl()); + PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); + QVERIFY(obj != 0); + + QDeclarativeProperty p(obj, "wrectProperty.x", qmlContext(obj)); + QCOMPARE(p.name(), QString("wrectProperty.x")); + + QCOMPARE(p.read(), QVariant(10)); + + //don't crash once the engine is deleted + delete engine; + engine = 0; + + QCOMPARE(p.propertyTypeName(), "int"); + QCOMPARE(p.read(), QVariant(10)); + p.write(QVariant(20)); + QCOMPARE(p.read(), QVariant(20)); +} + +void tst_qdeclarativeproperty::copy() +{ + PropertyObject object; + + QDeclarativeProperty *property = new QDeclarativeProperty(&object, QLatin1String("defaultProperty")); + QCOMPARE(property->name(), QString("defaultProperty")); + QCOMPARE(property->read(), QVariant(10)); + QCOMPARE(property->type(), QDeclarativeProperty::Property); + QCOMPARE(property->propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(property->propertyType(), (int)QVariant::Int); + + QDeclarativeProperty p1(*property); + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QDeclarativeProperty::Property); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QDeclarativeProperty p2(&object, QLatin1String("url")); + QCOMPARE(p2.name(), QString("url")); + p2 = *property; + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QDeclarativeProperty::Property); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); + + delete property; property = 0; + + QCOMPARE(p1.name(), QString("defaultProperty")); + QCOMPARE(p1.read(), QVariant(10)); + QCOMPARE(p1.type(), QDeclarativeProperty::Property); + QCOMPARE(p1.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(p1.propertyType(), (int)QVariant::Int); + + QCOMPARE(p2.name(), QString("defaultProperty")); + QCOMPARE(p2.read(), QVariant(10)); + QCOMPARE(p2.type(), QDeclarativeProperty::Property); + QCOMPARE(p2.propertyTypeCategory(), QDeclarativeProperty::Normal); + QCOMPARE(p2.propertyType(), (int)QVariant::Int); +} + +void tst_qdeclarativeproperty::initTestCase() +{ + QML_REGISTER_TYPE(Test,1,0,MyQmlObject,MyQmlObject); + QML_REGISTER_TYPE(Test,1,0,PropertyObject,PropertyObject); + QML_REGISTER_TYPE(Test,1,0,MyContainer,MyContainer); +} + + +QTEST_MAIN(tst_qdeclarativeproperty) + +#include "tst_qdeclarativeproperty.moc" diff --git a/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro new file mode 100644 index 0000000..aeccf9b --- /dev/null +++ b/tests/auto/declarative/qdeclarativepropertymap/qdeclarativepropertymap.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativepropertymap.cpp diff --git a/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp new file mode 100644 index 0000000..22c5581 --- /dev/null +++ b/tests/auto/declarative/qdeclarativepropertymap/tst_qdeclarativepropertymap.cpp @@ -0,0 +1,171 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/qdeclarativepropertymap.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativetext_p.h> +#include <QSignalSpy> + +class tst_QDeclarativePropertyMap : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativePropertyMap() {} + +private slots: + void insert(); + void operatorInsert(); + void operatorValue(); + void clear(); + void changed(); + void count(); +}; + +void tst_QDeclarativePropertyMap::insert() +{ + QDeclarativePropertyMap map; + map.insert(QLatin1String("key1"),100); + map.insert(QLatin1String("key2"),200); + QVERIFY(map.keys().count() == 2); + QVERIFY(map.contains(QLatin1String("key1"))); + + QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); + QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); + + map.insert(QLatin1String("key1"),"Hello World"); + QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); +} + +void tst_QDeclarativePropertyMap::operatorInsert() +{ + QDeclarativePropertyMap map; + map[QLatin1String("key1")] = 100; + map[QLatin1String("key2")] = 200; + QVERIFY(map.keys().count() == 2); + + QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); + QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); + + map[QLatin1String("key1")] = "Hello World"; + QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); +} + +void tst_QDeclarativePropertyMap::operatorValue() +{ + QDeclarativePropertyMap map; + map.insert(QLatin1String("key1"),100); + map.insert(QLatin1String("key2"),200); + QVERIFY(map.count() == 2); + QVERIFY(map.contains(QLatin1String("key1"))); + + const QDeclarativePropertyMap &constMap = map; + + QCOMPARE(constMap.value(QLatin1String("key1")), QVariant(100)); + QCOMPARE(constMap.value(QLatin1String("key2")), QVariant(200)); + QCOMPARE(constMap[QLatin1String("key1")], constMap.value(QLatin1String("key1"))); + QCOMPARE(constMap[QLatin1String("key2")], constMap.value(QLatin1String("key2"))); +} + +void tst_QDeclarativePropertyMap::clear() +{ + QDeclarativePropertyMap map; + map.insert(QLatin1String("key1"),100); + QVERIFY(map.keys().count() == 1); + + QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); + + map.clear(QLatin1String("key1")); + QVERIFY(map.keys().count() == 1); + QVERIFY(map.contains(QLatin1String("key1"))); + QCOMPARE(map.value(QLatin1String("key1")), QVariant()); +} + +void tst_QDeclarativePropertyMap::changed() +{ + QDeclarativePropertyMap map; + QSignalSpy spy(&map, SIGNAL(valueChanged(const QString&))); + map.insert(QLatin1String("key1"),100); + map.insert(QLatin1String("key2"),200); + QCOMPARE(spy.count(), 0); + + map.clear(QLatin1String("key1")); + QCOMPARE(spy.count(), 0); + + //make changes in QML + QDeclarativeEngine engine; + QDeclarativeContext *ctxt = engine.rootContext(); + ctxt->setContextProperty(QLatin1String("testdata"), &map); + QDeclarativeComponent component(&engine); + component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", + QUrl::fromLocalFile("")); + QVERIFY(component.isReady()); + QDeclarativeText *txt = qobject_cast<QDeclarativeText*>(component.create()); + QVERIFY(txt); + QCOMPARE(txt->text(), QString('X')); + QCOMPARE(spy.count(), 1); + QList<QVariant> arguments = spy.takeFirst(); + QCOMPARE(arguments.at(0).toString(),QLatin1String("key1")); + QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); +} + +void tst_QDeclarativePropertyMap::count() +{ + QDeclarativePropertyMap map; + QCOMPARE(map.isEmpty(), true); + map.insert(QLatin1String("key1"),100); + map.insert(QLatin1String("key2"),200); + QCOMPARE(map.count(), 2); + QCOMPARE(map.isEmpty(), false); + + map.insert(QLatin1String("key3"),"Hello World"); + QCOMPARE(map.count(), 3); + + //clearing doesn't remove the key + map.clear(QLatin1String("key3")); + QCOMPARE(map.count(), 3); + QCOMPARE(map.size(), map.count()); +} + +QTEST_MAIN(tst_QDeclarativePropertyMap) + +#include "tst_qdeclarativepropertymap.moc" diff --git a/tests/auto/declarative/qmlqt/data/closestangle.qml b/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml index b5f7fc6..b5f7fc6 100644 --- a/tests/auto/declarative/qmlqt/data/closestangle.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/closestangle.qml diff --git a/tests/auto/declarative/qmlqt/data/consoleLog.qml b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml index e657ff1..e657ff1 100644 --- a/tests/auto/declarative/qmlqt/data/consoleLog.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/consoleLog.qml diff --git a/tests/auto/declarative/qmlqt/data/createComponent.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml index d9b70ec..d9b70ec 100644 --- a/tests/auto/declarative/qmlqt/data/createComponent.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponent.qml diff --git a/tests/auto/declarative/qmlqt/data/createComponentData.qml b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml index a5e99a0..a5e99a0 100644 --- a/tests/auto/declarative/qmlqt/data/createComponentData.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createComponentData.qml diff --git a/tests/auto/declarative/qmlqt/data/createQmlObject.qml b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml index 9150782..9150782 100644 --- a/tests/auto/declarative/qmlqt/data/createQmlObject.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/createQmlObject.qml diff --git a/tests/auto/declarative/qmlqt/data/darker.qml b/tests/auto/declarative/qdeclarativeqt/data/darker.qml index 2df067e..2df067e 100644 --- a/tests/auto/declarative/qmlqt/data/darker.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/darker.qml diff --git a/tests/auto/declarative/qmlqt/data/enums.qml b/tests/auto/declarative/qdeclarativeqt/data/enums.qml index 1efa6f5..1efa6f5 100644 --- a/tests/auto/declarative/qmlqt/data/enums.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/enums.qml diff --git a/tests/auto/declarative/qmlqt/data/hsla.qml b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml index df51ccd..df51ccd 100644 --- a/tests/auto/declarative/qmlqt/data/hsla.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/hsla.qml diff --git a/tests/auto/declarative/qmlqt/data/lighter.qml b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml index 4e0c431..4e0c431 100644 --- a/tests/auto/declarative/qmlqt/data/lighter.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/lighter.qml diff --git a/tests/auto/declarative/qmlqt/data/md5.qml b/tests/auto/declarative/qdeclarativeqt/data/md5.qml index c474b71..c474b71 100644 --- a/tests/auto/declarative/qmlqt/data/md5.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/md5.qml diff --git a/tests/auto/declarative/qmlqt/data/point.qml b/tests/auto/declarative/qdeclarativeqt/data/point.qml index c383beb..c383beb 100644 --- a/tests/auto/declarative/qmlqt/data/point.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/point.qml diff --git a/tests/auto/declarative/qmlqt/data/rect.qml b/tests/auto/declarative/qdeclarativeqt/data/rect.qml index 82b6428..82b6428 100644 --- a/tests/auto/declarative/qmlqt/data/rect.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rect.qml diff --git a/tests/auto/declarative/qmlqt/data/rgba.qml b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml index 6dd6565..6dd6565 100644 --- a/tests/auto/declarative/qmlqt/data/rgba.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/rgba.qml diff --git a/tests/auto/declarative/qmlqt/data/size.qml b/tests/auto/declarative/qdeclarativeqt/data/size.qml index 05b0317..05b0317 100644 --- a/tests/auto/declarative/qmlqt/data/size.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/size.qml diff --git a/tests/auto/declarative/qmlqt/data/tint.qml b/tests/auto/declarative/qdeclarativeqt/data/tint.qml index da8afe2..da8afe2 100644 --- a/tests/auto/declarative/qmlqt/data/tint.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/tint.qml diff --git a/tests/auto/declarative/qmlqt/data/vector.qml b/tests/auto/declarative/qdeclarativeqt/data/vector.qml index a471c7a..a471c7a 100644 --- a/tests/auto/declarative/qmlqt/data/vector.qml +++ b/tests/auto/declarative/qdeclarativeqt/data/vector.qml diff --git a/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro new file mode 100644 index 0000000..aff00ad --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/qdeclarativeqt.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +SOURCES += tst_qdeclarativeqt.cpp +macx:CONFIG -= app_bundle + +DEFINES += SRCDIR=\\\"$$PWD\\\" + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp new file mode 100644 index 0000000..9ec6872 --- /dev/null +++ b/tests/auto/declarative/qdeclarativeqt/tst_qdeclarativeqt.cpp @@ -0,0 +1,369 @@ +/**************************************************************************** +** +** 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 <QDebug> +#include <QDeclarativeEngine> +#include <QFileInfo> +#include <QDeclarativeComponent> +#include <QDir> +#include <QVector3D> +#include <QCryptographicHash> +#include <QDeclarativeItem> + +class tst_qdeclarativeqt : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativeqt() {} + +private slots: + void enums(); + void rgba(); + void hsla(); + void rect(); + void point(); + void size(); + void vector(); + void lighter(); + void darker(); + void tint(); + void closestAngle(); + void playSound(); + void openUrlExternally(); + void md5(); + void createComponent(); + void createQmlObject(); + void consoleLog(); + +private: + QDeclarativeEngine engine; +}; + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +void tst_qdeclarativeqt::enums() +{ + QDeclarativeComponent component(&engine, TEST_FILE("enums.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape); + QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder); + QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle); + QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight); + + delete object; +} + +void tst_qdeclarativeqt::rgba() +{ + QDeclarativeComponent component(&engine, TEST_FILE("rgba.qml")); + + QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; + QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; + QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; + QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + + QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8)); + QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1)); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); + + delete object; +} + +void tst_qdeclarativeqt::hsla() +{ + QDeclarativeComponent component(&engine, TEST_FILE("hsla.qml")); + + QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; + QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; + QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; + QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8)); + QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1)); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); + + delete object; +} + +void tst_qdeclarativeqt::rect() +{ + QDeclarativeComponent component(&engine, TEST_FILE("rect.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109)); + QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6)); + QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF()); + QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF()); + QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF()); + + delete object; +} + +void tst_qdeclarativeqt::point() +{ + QDeclarativeComponent component(&engine, TEST_FILE("point.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34)); + QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2)); + QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF()); + QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF()); + + delete object; +} + +void tst_qdeclarativeqt::size() +{ + QDeclarativeComponent component(&engine, TEST_FILE("size.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34)); + QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2)); + QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10)); + QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF()); + QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF()); + + delete object; +} + +void tst_qdeclarativeqt::vector() +{ + QDeclarativeComponent component(&engine, TEST_FILE("vector.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9)); + QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1)); + QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D()); + QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D()); + + delete object; +} + +void tst_qdeclarativeqt::lighter() +{ + QDeclarativeComponent component(&engine, TEST_FILE("lighter.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter()); + QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter()); + QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); + + delete object; +} + +void tst_qdeclarativeqt::darker() +{ + QDeclarativeComponent component(&engine, TEST_FILE("darker.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker()); + QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker()); + QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); + + delete object; +} + +void tst_qdeclarativeqt::tint() +{ + QDeclarativeComponent component(&engine, TEST_FILE("tint.qml")); + + QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor"; + QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor"; + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1)); + QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0)); + QEXPECT_FAIL("", "QT-2424",Continue); + QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0, 0)); + QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); + QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); + + delete object; +} + +void tst_qdeclarativeqt::closestAngle() +{ + QDeclarativeComponent component(&engine, TEST_FILE("closestangle.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0); + QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0); + QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0); + QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0); + QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0); + QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11); + QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11); + + 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); + QVERIFY(false); +} + +void tst_qdeclarativeqt::md5() +{ + QDeclarativeComponent component(&engine, TEST_FILE("md5.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test1").toString(), QLatin1String(QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5).toHex())); + QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex())); + + delete object; +} + +void tst_qdeclarativeqt::createComponent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("createComponent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("incorrectArgCount1").toBool(), true); + QCOMPARE(object->property("incorrectArgCount2").toBool(), true); + QCOMPARE(object->property("emptyArg").toBool(), true); + + QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml")); + QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString()); + + delete object; +} + +void tst_qdeclarativeqt::createQmlObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("createQmlObject.qml")); + + QString warning1 = "QDeclarativeEngine::createQmlObject():"; + QString warning2 = " " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name"; + QString warning3 = "QDeclarativeEngine::createQmlObject(): Component is not ready"; + QString warning4 = "QDeclarativeEngine::createQmlObject():"; + QString warning5 = " " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method"; + + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); + QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5)); + + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("incorrectArgCount1").toBool(), true); + QCOMPARE(object->property("incorrectArgCount2").toBool(), true); + QCOMPARE(object->property("emptyArg").toBool(), true); + QCOMPARE(object->property("errors").toBool(), true); + QCOMPARE(object->property("noParent").toBool(), true); + QCOMPARE(object->property("notReady").toBool(), true); + QCOMPARE(object->property("runtimeError").toBool(), true); + QCOMPARE(object->property("success").toBool(), true); + + QDeclarativeItem *item = qobject_cast<QDeclarativeItem *>(object); + QVERIFY(item != 0); + QVERIFY(item->childItems().count() == 1); + + delete object; +} + +void tst_qdeclarativeqt::consoleLog() +{ + QTest::ignoreMessage(QtDebugMsg, "completed ok"); + QTest::ignoreMessage(QtDebugMsg, "completed ok"); + QDeclarativeComponent component(&engine, TEST_FILE("consoleLog.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + delete object; +} + +QTEST_MAIN(tst_qdeclarativeqt) + +#include "tst_qdeclarativeqt.moc" diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml index cf1fb4d..cf1fb4d 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/intmodel.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/intmodel.qml diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml index fc6b34c..fc6b34c 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/itemlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/itemlist.qml diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml index e6d0acb..e6d0acb 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/objlist.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/objlist.qml diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/properties.qml b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml index 550ce8d..550ce8d 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/properties.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/properties.qml diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/repeater.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater.qml index 7d83230..7d83230 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/repeater.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater.qml diff --git a/tests/auto/declarative/qmlgraphicsrepeater/data/repeater2.qml b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml index c3c3260..c3c3260 100644 --- a/tests/auto/declarative/qmlgraphicsrepeater/data/repeater2.qml +++ b/tests/auto/declarative/qdeclarativerepeater/data/repeater2.qml diff --git a/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro new file mode 100644 index 0000000..132123a --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/qdeclarativerepeater.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativerepeater.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp new file mode 100644 index 0000000..7a97e60 --- /dev/null +++ b/tests/auto/declarative/qdeclarativerepeater/tst_qdeclarativerepeater.cpp @@ -0,0 +1,385 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> +#include <QtTest/QSignalSpy> +#include <private/qlistmodelinterface_p.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativeview.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <private/qdeclarativerepeater_p.h> +#include <private/qdeclarativetext_p.h> + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +class tst_QDeclarativeRepeater : public QObject +{ + Q_OBJECT +public: + tst_QDeclarativeRepeater(); + +private slots: + void numberModel(); + void objectList(); + void stringList(); + void dataModel(); + void itemModel(); + void properties(); + +private: + QDeclarativeView *createView(); + template<typename T> + T *findItem(QGraphicsObject *parent, const QString &id); +}; + +class TestObject : public QObject +{ + Q_OBJECT + + Q_PROPERTY(bool error READ error WRITE setError) + Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged) + +public: + TestObject() : QObject(), mError(true), mUseModel(false) {} + + bool error() const { return mError; } + void setError(bool err) { mError = err; } + + bool useModel() const { return mUseModel; } + void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); } + +signals: + void useModelChanged(); + +private: + bool mError; + bool mUseModel; +}; + +class TestModel : public QAbstractListModel +{ +public: + enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; + + TestModel(QObject *parent=0) : QAbstractListModel(parent) { + QHash<int, QByteArray> roles; + roles[Name] = "name"; + roles[Number] = "number"; + setRoleNames(roles); + } + + int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } + QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { + QVariant rv; + if (role == Name) + rv = list.at(index.row()).first; + else if (role == Number) + rv = list.at(index.row()).second; + + return rv; + } + + int count() const { return rowCount(); } + QString name(int index) const { return list.at(index).first; } + QString number(int index) const { return list.at(index).second; } + + void addItem(const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), list.count(), list.count()); + list.append(QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void insertItem(int index, const QString &name, const QString &number) { + emit beginInsertRows(QModelIndex(), index, index); + list.insert(index, QPair<QString,QString>(name, number)); + emit endInsertRows(); + } + + void removeItem(int index) { + emit beginRemoveRows(QModelIndex(), index, index); + list.removeAt(index); + emit endRemoveRows(); + } + + void moveItem(int from, int to) { + emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); + list.move(from, to); + emit endMoveRows(); + } + + void modifyItem(int idx, const QString &name, const QString &number) { + list[idx] = QPair<QString,QString>(name, number); + emit dataChanged(index(idx,0), index(idx,0)); + } + +private: + QList<QPair<QString,QString> > list; +}; + + +tst_QDeclarativeRepeater::tst_QDeclarativeRepeater() +{ +} + +void tst_QDeclarativeRepeater::numberModel() +{ + QDeclarativeView *canvas = createView(); + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testData", 5); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/intmodel.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); + + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + + delete canvas; +} + +void tst_QDeclarativeRepeater::objectList() +{ + QDeclarativeView *canvas = createView(); + + QObjectList data; + for(int i=0; i<100; i++){ + data << new QObject(); + data.back()->setProperty("idx", i); + } + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testData", QVariant::fromValue(data)); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/objlist.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data + QCOMPARE(repeater->property("instantiated").toInt(), 100); +} + +/* +The Repeater element creates children at its own position in its parent's +stacking order. In this test we insert a repeater between two other Text +elements to test this. +*/ +void tst_QDeclarativeRepeater::stringList() +{ + QDeclarativeView *canvas = createView(); + + QStringList data; + data << "One"; + data << "Two"; + data << "Three"; + data << "Four"; + + QDeclarativeContext *ctxt = canvas->rootContext(); + ctxt->setContextProperty("testData", data); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + + QDeclarativeItem *container = findItem<QDeclarativeItem>(canvas->rootObject(), "container"); + QVERIFY(container != 0); + + QCOMPARE(container->childItems().count(), data.count() + 3); + + bool saw_repeater = false; + for (int i = 0; i < container->childItems().count(); ++i) { + + if (i == 0) { + QDeclarativeText *name = qobject_cast<QDeclarativeText*>(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), QLatin1String("Zero")); + } else if (i == container->childItems().count() - 2) { + // The repeater itself + QDeclarativeRepeater *rep = qobject_cast<QDeclarativeRepeater*>(container->childItems().at(i)); + QCOMPARE(rep, repeater); + saw_repeater = true; + continue; + } else if (i == container->childItems().count() - 1) { + QDeclarativeText *name = qobject_cast<QDeclarativeText*>(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), QLatin1String("Last")); + } else { + QDeclarativeText *name = qobject_cast<QDeclarativeText*>(container->childItems().at(i)); + QVERIFY(name != 0); + QCOMPARE(name->text(), data.at(i-1)); + } + } + QVERIFY(saw_repeater); + + delete canvas; +} + +void tst_QDeclarativeRepeater::dataModel() +{ + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + TestModel testModel; + testModel.addItem("one", "1"); + testModel.addItem("two", "2"); + testModel.addItem("three", "3"); + + ctxt->setContextProperty("testData", &testModel); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/repeater2.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + + QDeclarativeItem *container = findItem<QDeclarativeItem>(canvas->rootObject(), "container"); + QVERIFY(container != 0); + + QCOMPARE(container->childItems().count(), 4); + + testModel.addItem("four", "4"); + QCOMPARE(container->childItems().count(), 5); + + testModel.removeItem(2); + QCOMPARE(container->childItems().count(), 4); +} + +void tst_QDeclarativeRepeater::itemModel() +{ + QDeclarativeView *canvas = createView(); + QDeclarativeContext *ctxt = canvas->rootContext(); + TestObject *testObject = new TestObject; + ctxt->setContextProperty("testObject", testObject); + + canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/itemlist.qml")); + qApp->processEvents(); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(canvas->rootObject(), "repeater"); + QVERIFY(repeater != 0); + + QDeclarativeItem *container = findItem<QDeclarativeItem>(canvas->rootObject(), "container"); + QVERIFY(container != 0); + + QCOMPARE(container->childItems().count(), 1); + + testObject->setUseModel(true); + QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); + QVERIFY(testObject->error() == false); + + QCOMPARE(container->childItems().count(), 4); + QVERIFY(qobject_cast<QObject*>(container->childItems().at(0))->objectName() == "item1"); + QVERIFY(qobject_cast<QObject*>(container->childItems().at(1))->objectName() == "item2"); + QVERIFY(qobject_cast<QObject*>(container->childItems().at(2))->objectName() == "item3"); + QVERIFY(container->childItems().at(3) == repeater); + + delete canvas; +} + +void tst_QDeclarativeRepeater::properties() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("/properties.qml")); + + QDeclarativeItem *rootObject = qobject_cast<QDeclarativeItem*>(component.create()); + QVERIFY(rootObject); + + QDeclarativeRepeater *repeater = findItem<QDeclarativeRepeater>(rootObject, "repeater"); + QVERIFY(repeater); + + QSignalSpy modelSpy(repeater, SIGNAL(modelChanged())); + repeater->setModel(3); + QCOMPARE(modelSpy.count(),1); + repeater->setModel(3); + QCOMPARE(modelSpy.count(),1); + + QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); + + QDeclarativeComponent rectComponent(&engine); + rectComponent.setData("import Qt 4.6; Rectangle {}", QUrl::fromLocalFile("")); + + repeater->setDelegate(&rectComponent); + QCOMPARE(delegateSpy.count(),1); + repeater->setDelegate(&rectComponent); + QCOMPARE(delegateSpy.count(),1); +} + +QDeclarativeView *tst_QDeclarativeRepeater::createView() +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + canvas->setFixedSize(240,320); + + return canvas; +} + +template<typename T> +T *tst_QDeclarativeRepeater::findItem(QGraphicsObject *parent, const QString &objectName) +{ + const QMetaObject &mo = T::staticMetaObject; + if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName)) + return static_cast<T*>(parent); + for (int i = 0; i < parent->childItems().count(); ++i) { + QDeclarativeItem *child = qobject_cast<QDeclarativeItem*>(parent->childItems().at(i)); + if (!child) + continue; + QDeclarativeItem *item = findItem<T>(child, objectName); + if (item) + return static_cast<T*>(item); + } + + return 0; +} + +QTEST_MAIN(tst_QDeclarativeRepeater) + +#include "tst_qdeclarativerepeater.moc" diff --git a/tests/auto/declarative/qmlspringfollow/data/springfollow1.qml b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow1.qml index 959d206..959d206 100644 --- a/tests/auto/declarative/qmlspringfollow/data/springfollow1.qml +++ b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow1.qml diff --git a/tests/auto/declarative/qmlspringfollow/data/springfollow2.qml b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml index 7c81fb5..7c81fb5 100644 --- a/tests/auto/declarative/qmlspringfollow/data/springfollow2.qml +++ b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow2.qml diff --git a/tests/auto/declarative/qmlspringfollow/data/springfollow3.qml b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml index 6fec55b..6fec55b 100644 --- a/tests/auto/declarative/qmlspringfollow/data/springfollow3.qml +++ b/tests/auto/declarative/qdeclarativespringfollow/data/springfollow3.qml diff --git a/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro new file mode 100644 index 0000000..61aad0f --- /dev/null +++ b/tests/auto/declarative/qdeclarativespringfollow/qdeclarativespringfollow.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativespringfollow.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp new file mode 100644 index 0000000..7a60e78 --- /dev/null +++ b/tests/auto/declarative/qdeclarativespringfollow/tst_qdeclarativespringfollow.cpp @@ -0,0 +1,137 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativespringfollow_p.h> +#include <private/qdeclarativevaluetype_p.h> +#include "../../../shared/util.h" + +class tst_qdeclarativespringfollow : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativespringfollow(); + +private slots: + void defaultValues(); + void values(); + void disabled(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativespringfollow::tst_qdeclarativespringfollow() +{ +} + +void tst_qdeclarativespringfollow::defaultValues() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow1.qml")); + QDeclarativeSpringFollow *obj = qobject_cast<QDeclarativeSpringFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 0.); + QCOMPARE(obj->velocity(), 0.); + QCOMPARE(obj->spring(), 0.); + QCOMPARE(obj->damping(), 0.); + QCOMPARE(obj->epsilon(), 0.01); + QCOMPARE(obj->modulus(), 0.); + QCOMPARE(obj->value(), 0.); + QCOMPARE(obj->mass(), 1.); + QCOMPARE(obj->enabled(), true); + QCOMPARE(obj->inSync(), true); + + delete obj; +} + +void tst_qdeclarativespringfollow::values() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow2.qml")); + QDeclarativeSpringFollow *obj = qobject_cast<QDeclarativeSpringFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 1.44); + QCOMPARE(obj->velocity(), 0.9); + QCOMPARE(obj->spring(), 1.0); + QCOMPARE(obj->damping(), 0.5); + QCOMPARE(obj->epsilon(), 0.25); + QCOMPARE(obj->modulus(), 360.0); + QCOMPARE(obj->mass(), 2.0); + QCOMPARE(obj->enabled(), true); + + QTRY_COMPARE(obj->value(), 1.44); + QTRY_COMPARE(obj->inSync(), true); + + delete obj; +} + +void tst_qdeclarativespringfollow::disabled() +{ + QDeclarativeEngine engine; + QDeclarativeComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow3.qml")); + QDeclarativeSpringFollow *obj = qobject_cast<QDeclarativeSpringFollow*>(c.create()); + + QVERIFY(obj != 0); + + QCOMPARE(obj->sourceValue(), 1.44); + QCOMPARE(obj->velocity(), 0.9); + QCOMPARE(obj->spring(), 1.0); + QCOMPARE(obj->damping(), 0.5); + QCOMPARE(obj->epsilon(), 0.25); + QCOMPARE(obj->modulus(), 360.0); + QCOMPARE(obj->mass(), 2.0); + QCOMPARE(obj->enabled(), false); + + QCOMPARE(obj->value(), 0.0); + QCOMPARE(obj->inSync(), false); + + delete obj; +} + +QTEST_MAIN(tst_qdeclarativespringfollow) + +#include "tst_qdeclarativespringfollow.moc" diff --git a/tests/auto/declarative/qmlstates/data/ExtendedRectangle.qml b/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml index 8d64663..8d64663 100644 --- a/tests/auto/declarative/qmlstates/data/ExtendedRectangle.qml +++ b/tests/auto/declarative/qdeclarativestates/data/ExtendedRectangle.qml diff --git a/tests/auto/declarative/qmlstates/data/anchorChanges.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges.qml index 7dce889..7dce889 100644 --- a/tests/auto/declarative/qmlstates/data/anchorChanges.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges.qml diff --git a/tests/auto/declarative/qmlstates/data/anchorChanges2.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml index 545345e..545345e 100644 --- a/tests/auto/declarative/qmlstates/data/anchorChanges2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges2.qml diff --git a/tests/auto/declarative/qmlstates/data/anchorChanges3.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml index 9d5b317..9d5b317 100644 --- a/tests/auto/declarative/qmlstates/data/anchorChanges3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges3.qml diff --git a/tests/auto/declarative/qmlstates/data/anchorChanges4.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml index f128989..f128989 100644 --- a/tests/auto/declarative/qmlstates/data/anchorChanges4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges4.qml diff --git a/tests/auto/declarative/qmlstates/data/anchorChanges5.qml b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml index 4e6d34b..4e6d34b 100644 --- a/tests/auto/declarative/qmlstates/data/anchorChanges5.qml +++ b/tests/auto/declarative/qdeclarativestates/data/anchorChanges5.qml diff --git a/tests/auto/declarative/qmlstates/data/autoStateAtStartupRestoreBug.qml b/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml index 693a5c5..693a5c5 100644 --- a/tests/auto/declarative/qmlstates/data/autoStateAtStartupRestoreBug.qml +++ b/tests/auto/declarative/qdeclarativestates/data/autoStateAtStartupRestoreBug.qml diff --git a/tests/auto/declarative/qmlstates/data/basicBinding.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml index 6528113..6528113 100644 --- a/tests/auto/declarative/qmlstates/data/basicBinding.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding.qml diff --git a/tests/auto/declarative/qmlstates/data/basicBinding2.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml index 2e7b4cf..2e7b4cf 100644 --- a/tests/auto/declarative/qmlstates/data/basicBinding2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding2.qml diff --git a/tests/auto/declarative/qmlstates/data/basicBinding3.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml index a3c47d9..a3c47d9 100644 --- a/tests/auto/declarative/qmlstates/data/basicBinding3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding3.qml diff --git a/tests/auto/declarative/qmlstates/data/basicBinding4.qml b/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml index 1f52d0e..1f52d0e 100644 --- a/tests/auto/declarative/qmlstates/data/basicBinding4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicBinding4.qml diff --git a/tests/auto/declarative/qmlstates/data/basicChanges.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml index 88ea256..88ea256 100644 --- a/tests/auto/declarative/qmlstates/data/basicChanges.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges.qml diff --git a/tests/auto/declarative/qmlstates/data/basicChanges2.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml index 4dd293f..4dd293f 100644 --- a/tests/auto/declarative/qmlstates/data/basicChanges2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges2.qml diff --git a/tests/auto/declarative/qmlstates/data/basicChanges3.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml index 62ab1d5..62ab1d5 100644 --- a/tests/auto/declarative/qmlstates/data/basicChanges3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges3.qml diff --git a/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml b/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml new file mode 100644 index 0000000..a373cfc --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/basicChanges4.qml @@ -0,0 +1,19 @@ +import Qt.test 1.0 +import Qt 4.6 + +MyRectangle { + id: rect + width: 100; height: 100 + color: "red" + + states: State { + name: "aBlueDay" + PropertyChanges { + target: rect + onPropertyWithNotifyChanged: { rect.color = "blue"; } + } + } + + Component.onCompleted: rect.state = "aBlueDay" +} + diff --git a/tests/auto/declarative/qmlstates/data/basicExtension.qml b/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml index 1836f8a..1836f8a 100644 --- a/tests/auto/declarative/qmlstates/data/basicExtension.qml +++ b/tests/auto/declarative/qdeclarativestates/data/basicExtension.qml diff --git a/tests/auto/declarative/qmlstates/data/deleting.qml b/tests/auto/declarative/qdeclarativestates/data/deleting.qml index 3da0b12..3da0b12 100644 --- a/tests/auto/declarative/qmlstates/data/deleting.qml +++ b/tests/auto/declarative/qdeclarativestates/data/deleting.qml diff --git a/tests/auto/declarative/qmlstates/data/deletingState.qml b/tests/auto/declarative/qdeclarativestates/data/deletingState.qml index a5e8ed3..a5e8ed3 100644 --- a/tests/auto/declarative/qmlstates/data/deletingState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/deletingState.qml diff --git a/tests/auto/declarative/qmlstates/data/explicit.qml b/tests/auto/declarative/qdeclarativestates/data/explicit.qml index 7543f84..7543f84 100644 --- a/tests/auto/declarative/qmlstates/data/explicit.qml +++ b/tests/auto/declarative/qdeclarativestates/data/explicit.qml diff --git a/tests/auto/declarative/qmlstates/data/fakeExtension.qml b/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml index c7975e1..c7975e1 100644 --- a/tests/auto/declarative/qmlstates/data/fakeExtension.qml +++ b/tests/auto/declarative/qdeclarativestates/data/fakeExtension.qml diff --git a/tests/auto/declarative/qmlstates/data/illegalTempState.qml b/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml index 0dc39ae..0dc39ae 100644 --- a/tests/auto/declarative/qmlstates/data/illegalTempState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/illegalTempState.qml diff --git a/tests/auto/declarative/qmlstates/data/legalTempState.qml b/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml index 9be984c..9be984c 100644 --- a/tests/auto/declarative/qmlstates/data/legalTempState.qml +++ b/tests/auto/declarative/qdeclarativestates/data/legalTempState.qml diff --git a/tests/auto/declarative/qmlstates/data/nonExistantProp.qml b/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml index a5dd86a..a5dd86a 100644 --- a/tests/auto/declarative/qmlstates/data/nonExistantProp.qml +++ b/tests/auto/declarative/qdeclarativestates/data/nonExistantProp.qml diff --git a/tests/auto/declarative/qmlstates/data/parentChange.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange.qml index b8c7818..b8c7818 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange.qml diff --git a/tests/auto/declarative/qmlstates/data/parentChange2.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml index 8b23591..8b23591 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange2.qml diff --git a/tests/auto/declarative/qmlstates/data/parentChange3.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml index ddf9268..ddf9268 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange3.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange3.qml diff --git a/tests/auto/declarative/qmlstates/data/parentChange4.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml index 34d667a..34d667a 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange4.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange4.qml diff --git a/tests/auto/declarative/qmlstates/data/parentChange5.qml b/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml index 56bdd89..56bdd89 100644 --- a/tests/auto/declarative/qmlstates/data/parentChange5.qml +++ b/tests/auto/declarative/qdeclarativestates/data/parentChange5.qml diff --git a/tests/auto/declarative/qmlstates/data/propertyErrors.qml b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml index 080e833..080e833 100644 --- a/tests/auto/declarative/qmlstates/data/propertyErrors.qml +++ b/tests/auto/declarative/qdeclarativestates/data/propertyErrors.qml diff --git a/tests/auto/declarative/qdeclarativestates/data/reset.qml b/tests/auto/declarative/qdeclarativestates/data/reset.qml new file mode 100644 index 0000000..a0a2b8c --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/data/reset.qml @@ -0,0 +1,20 @@ +import Qt 4.6 + +Rectangle { + width: 640 + height: 480 + Text { + id: theText + width: 50 + wrap: true + text: "a text string that is longer than 50 pixels" + } + + states: State { + name: "state1" + PropertyChanges { + target: theText + width: undefined + } + } +} diff --git a/tests/auto/declarative/qmlstates/data/restoreEntryValues.qml b/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml index 088c608..088c608 100644 --- a/tests/auto/declarative/qmlstates/data/restoreEntryValues.qml +++ b/tests/auto/declarative/qdeclarativestates/data/restoreEntryValues.qml diff --git a/tests/auto/declarative/qmlstates/data/script.qml b/tests/auto/declarative/qdeclarativestates/data/script.qml index 3c5f33e..3c5f33e 100644 --- a/tests/auto/declarative/qmlstates/data/script.qml +++ b/tests/auto/declarative/qdeclarativestates/data/script.qml diff --git a/tests/auto/declarative/qmlstates/data/signalOverride.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml index 5ba1566..5ba1566 100644 --- a/tests/auto/declarative/qmlstates/data/signalOverride.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverride.qml diff --git a/tests/auto/declarative/qmlstates/data/signalOverride2.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml index 527e165..527e165 100644 --- a/tests/auto/declarative/qmlstates/data/signalOverride2.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverride2.qml diff --git a/tests/auto/declarative/qmlstates/data/signalOverrideCrash.qml b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml index 702fa86..702fa86 100644 --- a/tests/auto/declarative/qmlstates/data/signalOverrideCrash.qml +++ b/tests/auto/declarative/qdeclarativestates/data/signalOverrideCrash.qml diff --git a/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro new file mode 100644 index 0000000..f874803 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/qdeclarativestates.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativestates.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp new file mode 100644 index 0000000..8d3ca7a --- /dev/null +++ b/tests/auto/declarative/qdeclarativestates/tst_qdeclarativestates.cpp @@ -0,0 +1,969 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativeanchors_p_p.h> +#include <private/qdeclarativerectangle_p.h> +#include <private/qdeclarativetext_p.h> +#include <private/qdeclarativepropertychanges_p.h> +#include <private/qdeclarativestategroup_p.h> + + +class MyRect : public QDeclarativeRectangle +{ + Q_OBJECT + Q_PROPERTY(int propertyWithNotify READ propertyWithNotify WRITE setPropertyWithNotify NOTIFY oddlyNamedNotifySignal) +public: + MyRect() {} + + void doSomething() { emit didSomething(); } + + int propertyWithNotify() const { return m_prop; } + void setPropertyWithNotify(int i) { m_prop = i; emit oddlyNamedNotifySignal(); } +Q_SIGNALS: + void didSomething(); + void oddlyNamedNotifySignal(); + +private: + int m_prop; +}; + +QML_DECLARE_TYPE(MyRect) + + +class tst_qdeclarativestates : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativestates() {} + +private: + static QByteArray fullDataPath(const QString &path); + +private slots: + void initTestCase(); + + void basicChanges(); + void basicExtension(); + void basicBinding(); + void signalOverride(); + void signalOverrideCrash(); + void parentChange(); + void parentChangeErrors(); + void anchorChanges(); + void anchorChanges2(); + void anchorChanges3(); + void anchorChanges4(); + void anchorChanges5(); + void script(); + void restoreEntryValues(); + void explicitChanges(); + void propertyErrors(); + void incorrectRestoreBug(); + void autoStateAtStartupRestoreBug(); + void deletingChange(); + void deletingState(); + void tempState(); + void illegalTempState(); + void nonExistantProperty(); + void reset(); +}; + +void tst_qdeclarativestates::initTestCase() +{ + QML_REGISTER_TYPE(Qt.test, 1, 0, MyRectangle,MyRect); +} + +QByteArray tst_qdeclarativestates::fullDataPath(const QString &path) +{ + return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8(); +} + +void tst_qdeclarativestates::basicChanges() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),1); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),1); + + rect->setState("bordered"); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),2); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),1); + //### we should be checking that this is an implicit rather than explicit 1 (which currently fails) + + rect->setState("bordered"); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),2); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),1); + + } + + { + // Test basicChanges4.qml can magically connect to propertyWithNotify's notify + // signal using 'onPropertyWithNotifyChanged' even though the signal name is + // actually 'oddlyNamedNotifySignal' + + QDeclarativeComponent component(&engine, SRCDIR "/data/basicChanges4.qml"); + QVERIFY(component.isReady()); + + MyRect *rect = qobject_cast<MyRect*>(component.create()); + QVERIFY(rect != 0); + + QMetaProperty prop = rect->metaObject()->property(rect->metaObject()->indexOfProperty("propertyWithNotify")); + QVERIFY(prop.hasNotifySignal()); + QString notifySignal = QByteArray(prop.notifySignal().signature()); + QVERIFY(!notifySignal.startsWith("propertyWithNotifyChanged(")); + + QCOMPARE(rect->color(), QColor(Qt::red)); + + rect->setPropertyWithNotify(100); + QCOMPARE(rect->color(), QColor(Qt::blue)); + } +} + +void tst_qdeclarativestates::basicExtension() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),1); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),1); + + rect->setState("bordered"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),2); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),1); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),1); + + rect->setState("bordered"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->border()->width(),2); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->border()->width(),1); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + } +} + +void tst_qdeclarativestates::basicBinding() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + rect->setProperty("sourceColor", QColor("green")); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + rect->setProperty("sourceColor", QColor("yellow")); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("yellow")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + rect->setProperty("sourceColor", QColor("green")); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("green")); + rect->setProperty("sourceColor", QColor("yellow")); + QCOMPARE(rect->color(),QColor("yellow")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("yellow")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + rect->setProperty("sourceColor", QColor("green")); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + rect->setProperty("sourceColor", QColor("red")); + QCOMPARE(rect->color(),QColor("blue")); + rect->setProperty("sourceColor2", QColor("yellow")); + QCOMPARE(rect->color(),QColor("yellow")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + rect->setProperty("sourceColor2", QColor("green")); + QCOMPARE(rect->color(),QColor("red")); + rect->setProperty("sourceColor", QColor("yellow")); + QCOMPARE(rect->color(),QColor("yellow")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + rect->setProperty("sourceColor", QColor("yellow")); + QCOMPARE(rect->color(),QColor("yellow")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + rect->setProperty("sourceColor", QColor("purple")); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("purple")); + + rect->setState("green"); + QCOMPARE(rect->color(),QColor("green")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + } +} + +void tst_qdeclarativestates::signalOverride() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride.qml"); + MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + rect->doSomething(); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState("green"); + rect->doSomething(); + QCOMPARE(rect->color(),QColor("green")); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverride2.qml"); + MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("white")); + rect->doSomething(); + QCOMPARE(rect->color(),QColor("blue")); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("extendedRect")); + + innerRect->setState("green"); + rect->doSomething(); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(innerRect->color(),QColor("green")); + QCOMPARE(innerRect->property("extendedColor").value<QColor>(),QColor("green")); + } +} + +void tst_qdeclarativestates::signalOverrideCrash() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml"); + MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); + QVERIFY(rect != 0); + + rect->setState("overridden"); + rect->doSomething(); +} + +void tst_qdeclarativestates::parentChange() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeParentChange *pChange = qobject_cast<QDeclarativeParentChange*>(state->operationAt(0)); + QVERIFY(pChange != 0); + QDeclarativeItem *nParent = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("NewParent")); + QVERIFY(nParent != 0); + + QCOMPARE(pChange->parent(), nParent); + + rect->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(0)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(-133)); + QCOMPARE(innerRect->y(), qreal(-300)); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + rect->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(15)); + QCOMPARE(innerRect->scale(), qreal(.5)); + QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-19.9075)); + QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-8.73433)); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + rect->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(-37)); + QCOMPARE(innerRect->scale(), qreal(.25)); + QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-217.305)); + QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-164.413)); + + rect->setState(""); + QCOMPARE(innerRect->rotation(), qreal(0)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(5)); + //do a non-qFuzzyCompare fuzzy compare + QVERIFY(innerRect->y() < qreal(0.00001) && innerRect->y() > qreal(-0.00001)); + } +} + +void tst_qdeclarativestates::parentChangeErrors() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange4.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange4.qml") + ":25:9) Unable to preserve appearance under non-uniform scale").constData()); + rect->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(0)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(5)); + QCOMPARE(innerRect->y(), qreal(5)); + } + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/parentChange5.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange5.qml") + ":25:9) Unable to preserve appearance under complex transform").constData()); + rect->setState("reparented"); + QCOMPARE(innerRect->rotation(), qreal(0)); + QCOMPARE(innerRect->scale(), qreal(1)); + QCOMPARE(innerRect->x(), qreal(5)); + QCOMPARE(innerRect->y(), qreal(5)); + } +} + +void tst_qdeclarativestates::anchorChanges() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rect->setState("right"); + QCOMPARE(innerRect->x(), qreal(150)); + QCOMPARE(aChanges->reset(), QString("left")); + QCOMPARE(aChanges->object(), innerRect); + QCOMPARE(aChanges->right().item, rect->right().item); + QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine); + + rect->setState(""); + QCOMPARE(innerRect->x(), qreal(5)); + + delete rect; +} + +void tst_qdeclarativestates::anchorChanges2() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + rect->setState("right"); + QEXPECT_FAIL("", "QTBUG-5338", Continue); + QCOMPARE(innerRect->x(), qreal(150)); + + rect->setState(""); + QCOMPARE(innerRect->x(), qreal(5)); + + delete rect; +} + +void tst_qdeclarativestates::anchorChanges3() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline")); + QVERIFY(leftGuideline != 0); + + QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline")); + QVERIFY(bottomGuideline != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rect->setState("reanchored"); + QCOMPARE(aChanges->object(), innerRect); + QCOMPARE(aChanges->left().item, leftGuideline->left().item); + QCOMPARE(aChanges->left().anchorLine, leftGuideline->left().anchorLine); + QCOMPARE(aChanges->right().item, rect->right().item); + QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine); + QCOMPARE(aChanges->top().item, rect->top().item); + QCOMPARE(aChanges->top().anchorLine, rect->top().anchorLine); + QCOMPARE(aChanges->bottom().item, bottomGuideline->bottom().item); + QCOMPARE(aChanges->bottom().anchorLine, bottomGuideline->bottom().anchorLine); + + QCOMPARE(innerRect->x(), qreal(10)); + QCOMPARE(innerRect->y(), qreal(0)); + QCOMPARE(innerRect->width(), qreal(190)); + QCOMPARE(innerRect->height(), qreal(150)); + + rect->setState(""); + QCOMPARE(innerRect->x(), qreal(0)); + QCOMPARE(innerRect->y(), qreal(10)); + QCOMPARE(innerRect->width(), qreal(150)); + QCOMPARE(innerRect->height(), qreal(190)); + + delete rect; +} + +void tst_qdeclarativestates::anchorChanges4() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges4.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline")); + QVERIFY(leftGuideline != 0); + + QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline")); + QVERIFY(bottomGuideline != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rect->setState("reanchored"); + QCOMPARE(aChanges->object(), innerRect); + QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item); + QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); + QCOMPARE(aChanges->verticalCenter().item, leftGuideline->verticalCenter().item); + QCOMPARE(aChanges->verticalCenter().anchorLine, leftGuideline->verticalCenter().anchorLine); + + delete rect; +} + +void tst_qdeclarativestates::anchorChanges5() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/anchorChanges5.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeRectangle *innerRect = qobject_cast<QDeclarativeRectangle*>(rect->findChild<QDeclarativeRectangle*>("MyRect")); + QVERIFY(innerRect != 0); + + QDeclarativeItem *leftGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("LeftGuideline")); + QVERIFY(leftGuideline != 0); + + QDeclarativeItem *bottomGuideline = qobject_cast<QDeclarativeItem*>(rect->findChild<QDeclarativeItem*>("BottomGuideline")); + QVERIFY(bottomGuideline != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativeAnchorChanges *aChanges = qobject_cast<QDeclarativeAnchorChanges*>(state->operationAt(0)); + QVERIFY(aChanges != 0); + + rect->setState("reanchored"); + QCOMPARE(aChanges->object(), innerRect); + QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item); + QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); + QCOMPARE(aChanges->baseline().item, leftGuideline->baseline().item); + QCOMPARE(aChanges->baseline().anchorLine, leftGuideline->baseline().anchorLine); + + delete rect; +} + +void tst_qdeclarativestates::script() +{ + QDeclarativeEngine engine; + + { + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/script.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("blue")); // a script isn't reverted + } +} + +void tst_qdeclarativestates::restoreEntryValues() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("blue")); +} + +void tst_qdeclarativestates::explicitChanges() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/explicit.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeListReference list(rect, "states"); + QDeclarativeState *state = qobject_cast<QDeclarativeState*>(list.at(0)); + QVERIFY(state != 0); + + qmlExecuteDeferred(state); + QDeclarativePropertyChanges *changes = qobject_cast<QDeclarativePropertyChanges*>(rect->findChild<QDeclarativePropertyChanges*>("changes")); + QVERIFY(changes != 0); + QVERIFY(changes->isExplicit()); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setProperty("sourceColor", QColor("green")); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + rect->setProperty("sourceColor", QColor("yellow")); + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("yellow")); +} + +void tst_qdeclarativestates::propertyErrors() +{ + QDeclarativeEngine engine; + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existent property \"colr\"").constData()); + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to read-only property \"wantsFocus\"").constData()); + rect->setState("blue"); +} + +void tst_qdeclarativestates::incorrectRestoreBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QCOMPARE(rect->color(),QColor("red")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + // make sure if we change the base state value, we then restore to it correctly + rect->setColor(QColor("green")); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("green")); +} + +void tst_qdeclarativestates::autoStateAtStartupRestoreBug() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml"); + QObject *obj = component.create(); + + QVERIFY(obj != 0); + QCOMPARE(obj->property("test").toInt(), 3); + + obj->setProperty("input", 2); + + QCOMPARE(obj->property("test").toInt(), 9); + + delete obj; +} + +void tst_qdeclarativestates::deletingChange() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + QCOMPARE(rect->radius(),qreal(5)); + + rect->setState(""); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(0)); + + QDeclarativePropertyChanges *pc = rect->findChild<QDeclarativePropertyChanges*>("pc1"); + QVERIFY(pc != 0); + delete pc; + + QDeclarativeState *state = rect->findChild<QDeclarativeState*>(); + QVERIFY(state != 0); + qmlExecuteDeferred(state); + QCOMPARE(state->operationCount(), 1); + + rect->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + QCOMPARE(rect->radius(),qreal(5)); + + delete rect; +} + +void tst_qdeclarativestates::deletingState() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QDeclarativeStateGroup *sg = rect->findChild<QDeclarativeStateGroup*>(); + QVERIFY(sg != 0); + QVERIFY(sg->findState("blue") != 0); + + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("blue")); + + sg->setState(""); + QCOMPARE(rect->color(),QColor("red")); + + QDeclarativeState *state = rect->findChild<QDeclarativeState*>(); + QVERIFY(state != 0); + delete state; + + QVERIFY(sg->findState("blue") == 0); + + //### should we warn that state doesn't exist + sg->setState("blue"); + QCOMPARE(rect->color(),QColor("red")); + + delete rect; +} + +void tst_qdeclarativestates::tempState() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QTest::ignoreMessage(QtDebugMsg, "entering placed"); + QTest::ignoreMessage(QtDebugMsg, "entering idle"); + rect->setState("placed"); + QCOMPARE(rect->state(), QLatin1String("idle")); +} + +void tst_qdeclarativestates::illegalTempState() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QTest::ignoreMessage(QtWarningMsg, "Can't apply a state change as part of a state definition. "); + rect->setState("placed"); + QCOMPARE(rect->state(), QLatin1String("placed")); +} + +void tst_qdeclarativestates::nonExistantProperty() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(rectComponent.create()); + QVERIFY(rect != 0); + + QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existent property \"colr\"").constData()); + rect->setState("blue"); + QCOMPARE(rect->state(), QLatin1String("blue")); +} + +void tst_qdeclarativestates::reset() +{ + QDeclarativeEngine engine; + + QDeclarativeComponent c(&engine, SRCDIR "/data/reset.qml"); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle*>(c.create()); + QVERIFY(rect != 0); + + QDeclarativeText *text = rect->findChild<QDeclarativeText*>(); + QVERIFY(text != 0); + QCOMPARE(text->width(), qreal(50.)); + QVERIFY(text->width() < text->height()); + + rect->setState("state1"); + + QVERIFY(text->width() > 51); + QVERIFY(text->width() > text->height()); +} + +QTEST_MAIN(tst_qdeclarativestates) + +#include "tst_qdeclarativestates.moc" diff --git a/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro new file mode 100644 index 0000000..bd4d829 --- /dev/null +++ b/tests/auto/declarative/qdeclarativestyledtext/qdeclarativestyledtext.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +QT += network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativestyledtext.cpp + +# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage +# LIBS += -lgcov diff --git a/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp new file mode 100644 index 0000000..7b1293e --- /dev/null +++ b/tests/auto/declarative/qdeclarativestyledtext/tst_qdeclarativestyledtext.cpp @@ -0,0 +1,96 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> +#include <QtGui/QTextLayout> +#include <private/qdeclarativestyledtext_p.h> + +class tst_qdeclarativestyledtext : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativestyledtext() + { + } + +private slots: + void textOutput(); + void textOutput_data(); +}; + +// For malformed input all we test is that we get the expected text out. +// +void tst_qdeclarativestyledtext::textOutput_data() +{ + QTest::addColumn<QString>("input"); + QTest::addColumn<QString>("output"); + + QTest::newRow("bold") << "<b>bold</b>" << "bold"; + QTest::newRow("italic") << "<b>italic</b>" << "italic"; + QTest::newRow("missing >") << "<b>text</b" << "text"; + QTest::newRow("missing b>") << "<b>text</" << "text"; + QTest::newRow("missing /b>") << "<b>text<" << "text"; + QTest::newRow("missing </b>") << "<b>text" << "text"; + QTest::newRow("bad nest") << "<b>text <i>italic</b></i>" << "text italic"; + QTest::newRow("font color") << "<font color=\"red\">red text</font>" << "red text"; + QTest::newRow("font size") << "<font size=\"1\">text</font>" << "text"; + QTest::newRow("font empty") << "<font>text</font>" << "text"; + QTest::newRow("font bad 1") << "<font ezis=\"blah\">text</font>" << "text"; + QTest::newRow("font bad 2") << "<font size=\"1>text</font>" << ""; + QTest::newRow("extra close") << "<b>text</b></b>" << "text"; + QTest::newRow("empty") << "" << ""; +} + +void tst_qdeclarativestyledtext::textOutput() +{ + QFETCH(QString, input); + QFETCH(QString, output); + + QTextLayout layout; + QDeclarativeStyledText::parse(input, layout); + + QCOMPARE(layout.text(), output); +} + + +QTEST_MAIN(tst_qdeclarativestyledtext) + +#include "tst_qdeclarativestyledtext.moc" diff --git a/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro new file mode 100644 index 0000000..0781774 --- /dev/null +++ b/tests/auto/declarative/qdeclarativesystempalette/qdeclarativesystempalette.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativesystempalette.cpp diff --git a/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp new file mode 100644 index 0000000..5c93952 --- /dev/null +++ b/tests/auto/declarative/qdeclarativesystempalette/tst_qdeclarativesystempalette.cpp @@ -0,0 +1,187 @@ +/**************************************************************************** +** +** 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 <QDebug> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativesystempalette_p.h> +#include <qpalette.h> +#include "../../../shared/util.h" + +class tst_qdeclarativesystempalette : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativesystempalette(); + +private slots: + void activePalette(); + void inactivePalette(); + void disabledPalette(); + void paletteChanged(); + +private: + QDeclarativeEngine engine; +}; + +tst_qdeclarativesystempalette::tst_qdeclarativesystempalette() +{ +} + +void tst_qdeclarativesystempalette::activePalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Active); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +void tst_qdeclarativesystempalette::inactivePalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); + + QVERIFY(object != 0); + QVERIFY(object->colorGroup() == QDeclarativeSystemPalette::Inactive); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Inactive); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +void tst_qdeclarativesystempalette::disabledPalette() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); + + QVERIFY(object != 0); + QVERIFY(object->colorGroup() == QDeclarativeSystemPalette::Disabled); + + QPalette palette; + palette.setCurrentColorGroup(QPalette::Disabled); + QCOMPARE(palette.window().color(), object->window()); + QCOMPARE(palette.windowText().color(), object->windowText()); + QCOMPARE(palette.base().color(), object->base()); + QCOMPARE(palette.text().color(), object->text()); + QCOMPARE(palette.alternateBase().color(), object->alternateBase()); + QCOMPARE(palette.button().color(), object->button()); + QCOMPARE(palette.buttonText().color(), object->buttonText()); + QCOMPARE(palette.light().color(), object->light()); + QCOMPARE(palette.midlight().color(), object->midlight()); + QCOMPARE(palette.dark().color(), object->dark()); + QCOMPARE(palette.mid().color(), object->mid()); + QCOMPARE(palette.shadow().color(), object->shadow()); + QCOMPARE(palette.highlight().color(), object->highlight()); + QCOMPARE(palette.highlightedText().color(), object->highlightedText()); + + delete object; +} + +void tst_qdeclarativesystempalette::paletteChanged() +{ + QString componentStr = "import Qt 4.6\nSystemPalette { }"; + QDeclarativeComponent component(&engine); + component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeSystemPalette *object = qobject_cast<QDeclarativeSystemPalette*>(component.create()); + + QVERIFY(object != 0); + + QPalette p; + p.setCurrentColorGroup(QPalette::Active); + p.setColor(QPalette::Active, QPalette::Text, QColor("red")); + p.setColor(QPalette::Active, QPalette::ButtonText, QColor("green")); + p.setColor(QPalette::Active, QPalette::WindowText, QColor("blue")); + + qApp->setPalette(p); + + object->setColorGroup(QDeclarativeSystemPalette::Active); + QTRY_COMPARE(QColor("red"), object->text()); + QTRY_COMPARE(QColor("green"), object->buttonText()); + QTRY_COMPARE(QColor("blue"), object->windowText()); + + delete object; +} + +QTEST_MAIN(tst_qdeclarativesystempalette) + +#include "tst_qdeclarativesystempalette.moc" diff --git a/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro new file mode 100644 index 0000000..8b4b4d1 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetext/qdeclarativetext.pro @@ -0,0 +1,5 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativetext.cpp diff --git a/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp new file mode 100644 index 0000000..bbbbd83 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetext/tst_qdeclarativetext.cpp @@ -0,0 +1,844 @@ +/**************************************************************************** +** +** 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 <QTextDocument> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativetext_p.h> +#include <private/qdeclarativevaluetype_p.h> +#include <QFontMetrics> +#include <QGraphicsSceneMouseEvent> +#include <qmath.h> + +class tst_qdeclarativetext : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativetext(); + +private slots: + void text(); + void width(); + void wrap(); + void elide(); + void textFormat(); + + // ### these tests may be trivial + void horizontalAlignment(); + void verticalAlignment(); + void font(); + void style(); + void color(); + void smooth(); + + // QDeclarativeFontValueType + void weight(); + void underline(); + void overline(); + void strikeout(); + void capitalization(); + void letterSpacing(); + void wordSpacing(); + + void clickLink(); + +private: + QStringList standard; + QStringList richText; + + QStringList horizontalAlignmentmentStrings; + QStringList verticalAlignmentmentStrings; + + QList<Qt::Alignment> verticalAlignmentments; + QList<Qt::Alignment> horizontalAlignmentments; + + QStringList styleStrings; + QList<QDeclarativeText::TextStyle> styles; + + QStringList colorStrings; + + QDeclarativeEngine engine; +}; + +tst_qdeclarativetext::tst_qdeclarativetext() +{ + standard << "the quick brown fox jumped over the lazy dog" + << "the quick brown fox\n jumped over the lazy dog"; + + richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>" + << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>"; + + horizontalAlignmentmentStrings << "AlignLeft" + << "AlignRight" + << "AlignHCenter"; + + verticalAlignmentmentStrings << "AlignTop" + << "AlignBottom" + << "AlignVCenter"; + + horizontalAlignmentments << Qt::AlignLeft + << Qt::AlignRight + << Qt::AlignHCenter; + + verticalAlignmentments << Qt::AlignTop + << Qt::AlignBottom + << Qt::AlignVCenter; + + styleStrings << "Normal" + << "Outline" + << "Raised" + << "Sunken"; + + styles << QDeclarativeText::Normal + << QDeclarativeText::Outline + << QDeclarativeText::Raised + << QDeclarativeText::Sunken; + + colorStrings << "aliceblue" + << "antiquewhite" + << "aqua" + << "darkkhaki" + << "darkolivegreen" + << "dimgray" + << "palevioletred" + << "lightsteelblue" + << "#000000" + << "#AAAAAA" + << "#FFFFFF" + << "#2AC05F"; + // + // need a different test to do alpha channel test + // << "#AA0011DD" + // << "#00F16B11"; + // +} + +void tst_qdeclarativetext::text() +{ + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->text(), QString("")); + QVERIFY(textObject->width() == 0); + + delete textObject; + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->text(), standard.at(i)); + QVERIFY(textObject->width() > 0); + } + + for (int i = 0; i < richText.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QString expected = richText.at(i); + QCOMPARE(textObject->text(), expected.replace("\\\"", "\"")); + QVERIFY(textObject->width() > 0); + } +} + +void tst_qdeclarativetext::width() +{ + // uses Font metrics to find the width for standard and document to find the width for rich + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->width(), 0.); + } + + for (int i = 0; i < standard.size(); i++) + { + QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test + + QFont f; + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = qCeil(metricWidth); + + QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->width(), qreal(metricWidth)); + QVERIFY(textObject->textFormat() == QDeclarativeText::AutoText); // setting text doesn't change format + } + + for (int i = 0; i < richText.size(); i++) + { + QVERIFY(Qt::mightBeRichText(richText.at(i))); // self-test + + QTextDocument document; + document.setHtml(richText.at(i)); + document.setDocumentMargin(0); + + int documentWidth = document.idealWidth(); + + QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->width(), qreal(documentWidth)); + QVERIFY(textObject->textFormat() == QDeclarativeText::AutoText); // setting text doesn't change format + } +} + +void tst_qdeclarativetext::wrap() +{ + int textHeight = 0; + // for specified width and wrap set true + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + textHeight = textObject->height(); + + QVERIFY(textObject != 0); + QVERIFY(textObject->wrap() == true); + QCOMPARE(textObject->width(), 300.); + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->width(), 30.); + QVERIFY(textObject->height() > textHeight); + + int oldHeight = textObject->height(); + textObject->setWidth(100); + QVERIFY(textObject->height() < oldHeight); + } + + for (int i = 0; i < richText.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->width(), 30.); + QVERIFY(textObject->height() > textHeight); + } + +} + +void tst_qdeclarativetext::elide() +{ + for (QDeclarativeText::TextElideMode m = QDeclarativeText::ElideLeft; m<=QDeclarativeText::ElideNone; m=QDeclarativeText::TextElideMode(int(m)+1)) { + const char* elidename[]={"ElideLeft", "ElideRight", "ElideMiddle", "ElideNone"}; + QString elide = "elide: Text." + QString(elidename[int(m)]) + ";"; + + // XXX Poor coverage. + + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->elideMode(), m); + QCOMPARE(textObject->width(), 100.); + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->elideMode(), m); + QCOMPARE(textObject->width(), 100.); + } + + // richtext - does nothing + for (int i = 0; i < richText.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->elideMode(), m); + QCOMPARE(textObject->width(), 100.); + } + } +} + +void tst_qdeclarativetext::textFormat() +{ + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QVERIFY(textObject->textFormat() == QDeclarativeText::RichText); + } + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QVERIFY(textObject->textFormat() == QDeclarativeText::PlainText); + } +} + +//the alignment tests may be trivial o.oa +void tst_qdeclarativetext::horizontalAlignment() +{ + //test one align each, and then test if two align fails. + + for (int i = 0; i < standard.size(); i++) + { + for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); + } + } + + for (int i = 0; i < richText.size(); i++) + { + for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); + } + } + +} + +void tst_qdeclarativetext::verticalAlignment() +{ + //test one align each, and then test if two align fails. + + for (int i = 0; i < standard.size(); i++) + { + for (int j=0; j < verticalAlignmentmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); + } + } + + for (int i = 0; i < richText.size(); i++) + { + for (int j=0; j < verticalAlignmentmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); + } + } + +} + +void tst_qdeclarativetext::font() +{ + //test size, then bold, then italic, then family + { + QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().pointSize(), 40); + QCOMPARE(textObject->font().bold(), false); + QCOMPARE(textObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().pixelSize(), 40); + QCOMPARE(textObject->font().bold(), false); + QCOMPARE(textObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().bold(), true); + QCOMPARE(textObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().italic(), true); + QCOMPARE(textObject->font().bold(), false); + } + + { + QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().family(), QString("Helvetica")); + QCOMPARE(textObject->font().bold(), false); + QCOMPARE(textObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->font().family(), QString("")); + } +} + +void tst_qdeclarativetext::style() +{ + //test style + for (int i = 0; i < styles.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE((int)textObject->style(), (int)styles.at(i)); + QCOMPARE(textObject->styleColor(), QColor("white")); + } +} + +void tst_qdeclarativetext::color() +{ + //test style + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); + QCOMPARE(textObject->styleColor(), QColor()); + } + + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i))); + // default color to black? + QCOMPARE(textObject->color(), QColor("black")); + } + + for (int i = 0; i < colorStrings.size(); i++) + { + for (int j = 0; j < colorStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); + QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(j))); + } + } + { + QString colorStr = "#AA001234"; + QColor testColor("#001234"); + testColor.setAlpha(170); + + QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QCOMPARE(textObject->color(), testColor); + } +} + +void tst_qdeclarativetext::smooth() +{ + for (int i = 0; i < standard.size(); i++) + { + { + QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + QCOMPARE(textObject->smooth(), true); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + QCOMPARE(textObject->smooth(), false); + } + } + for (int i = 0; i < richText.size(); i++) + { + { + QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + QCOMPARE(textObject->smooth(), true); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + QCOMPARE(textObject->smooth(), false); + } + } +} + +void tst_qdeclarativetext::weight() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Normal); + } + { + QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().weight(), (int)QDeclarativeFontValueType::Bold); + } +} + +void tst_qdeclarativetext::underline() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().underline(), false); + } + { + QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().underline(), true); + } +} + +void tst_qdeclarativetext::overline() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().overline(), false); + } + { + QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().overline(), true); + } +} + +void tst_qdeclarativetext::strikeout() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().strikeOut(), false); + } + { + QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().strikeOut(), true); + } +} + +void tst_qdeclarativetext::capitalization() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::MixedCase); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllUppercase); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::AllLowercase); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::SmallCaps); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE((int)textObject->font().capitalization(), (int)QDeclarativeFontValueType::Capitalize); + } +} + +void tst_qdeclarativetext::letterSpacing() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().letterSpacing(), 0.0); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().letterSpacing(), -50.); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().letterSpacing(), 200.); + } +} + +void tst_qdeclarativetext::wordSpacing() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().wordSpacing(), 0.0); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().wordSpacing(), -50.); + } + { + QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + QCOMPARE(textObject->font().wordSpacing(), 200.); + } +} + +class EventSender : public QGraphicsItem +{ +public: + void sendEvent(QEvent *event) { sceneEvent(event); } +}; + +class LinkTest : public QObject +{ + Q_OBJECT +public: + LinkTest() {} + + QString link; + +public slots: + void linkClicked(QString l) { link = l; } +}; + +void tst_qdeclarativetext::clickLink() +{ + { + QString componentStr = "import Qt 4.6\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; + QDeclarativeComponent textComponent(&engine); + textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); + QDeclarativeText *textObject = qobject_cast<QDeclarativeText*>(textComponent.create()); + + QVERIFY(textObject != 0); + + LinkTest test; + QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString))); + + { + QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress); + me.setPos(QPointF(textObject->x()/2, textObject->y()/2)); + me.setButton(Qt::LeftButton); + static_cast<EventSender*>(static_cast<QGraphicsItem*>(textObject))->sendEvent(&me); + } + + { + QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMouseRelease); + me.setPos(QPointF(textObject->x()/2, textObject->y()/2)); + me.setButton(Qt::LeftButton); + static_cast<EventSender*>(static_cast<QGraphicsItem*>(textObject))->sendEvent(&me); + } + + QCOMPARE(test.link, QLatin1String("http://qt.nokia.com")); + } +} + +QTEST_MAIN(tst_qdeclarativetext) + +#include "tst_qdeclarativetext.moc" diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/cursorTest.qml b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml index e5df8f1..e5df8f1 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/cursorTest.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/cursorTest.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml index 34b3883..34b3883 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/ErrItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/ErrItem.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml index 718cb71..718cb71 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/NormItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/NormItem.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml index 3c31e11..3c31e11 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTest.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTest.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml index a44aec2..a44aec2 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail1.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail1.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml index 57d3e47..57d3e47 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestFail2.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestFail2.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml index a44e867..a44e867 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/http/cursorHttpTestPass.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/http/cursorHttpTestPass.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml index ddbf526..ddbf526 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/httpfail/FailItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/httpfail/FailItem.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml b/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml index ddbf526..ddbf526 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/httpslow/WaitItem.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/httpslow/WaitItem.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml b/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml index c3d4c16..c3d4c16 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/inputmethodhints.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/inputmethodhints.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/navigation.qml b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml index 8d7dbbc..8d7dbbc 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/navigation.qml diff --git a/tests/auto/declarative/qmlgraphicstextedit/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml index 103a627..103a627 100644 --- a/tests/auto/declarative/qmlgraphicstextedit/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextedit/data/readOnly.qml diff --git a/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro new file mode 100644 index 0000000..2228f11 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/qdeclarativetextedit.pro @@ -0,0 +1,9 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui network +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativetextedit.cpp ../shared/testhttpserver.cpp +HEADERS += ../shared/testhttpserver.h + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp new file mode 100644 index 0000000..b677fec --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextedit/tst_qdeclarativetextedit.cpp @@ -0,0 +1,791 @@ +/**************************************************************************** +** +** 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 "../../../shared/util.h" +#include "../shared/testhttpserver.h" +#include <math.h> +#include <QFile> +#include <QTextDocument> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecontext.h> +#include <QtDeclarative/qdeclarativeexpression.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativetextedit_p.h> +#include <QFontMetrics> +#include <QDeclarativeView> +#include <QStyle> +#include <QInputContext> + +class tst_qdeclarativetextedit : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativetextedit(); + +private slots: + void text(); + void width(); + void wrap(); + void textFormat(); + + // ### these tests may be trivial + void hAlign(); + void vAlign(); + void font(); + void color(); + void textMargin(); + void persistentSelection(); + void focusOnPress(); + void selection(); + void inputMethodHints(); + + void cursorDelegate(); + void delegateLoading(); + void navigation(); + void readOnly(); + void sendRequestSoftwareInputPanelEvent(); + +private: + void simulateKey(QDeclarativeView *, int key); + QDeclarativeView *createView(const QString &filename); + + QStringList standard; + QStringList richText; + + QStringList hAlignmentStrings; + QStringList vAlignmentStrings; + + QList<Qt::Alignment> vAlignments; + QList<Qt::Alignment> hAlignments; + + QStringList colorStrings; + + QDeclarativeEngine engine; +}; + +tst_qdeclarativetextedit::tst_qdeclarativetextedit() +{ + standard << "the quick brown fox jumped over the lazy dog" + << "the quick brown fox\n jumped over the lazy dog"; + + richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>" + << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>"; + + hAlignmentStrings << "AlignLeft" + << "AlignRight" + << "AlignHCenter"; + + vAlignmentStrings << "AlignTop" + << "AlignBottom" + << "AlignVCenter"; + + hAlignments << Qt::AlignLeft + << Qt::AlignRight + << Qt::AlignHCenter; + + vAlignments << Qt::AlignTop + << Qt::AlignBottom + << Qt::AlignVCenter; + + colorStrings << "aliceblue" + << "antiquewhite" + << "aqua" + << "darkkhaki" + << "darkolivegreen" + << "dimgray" + << "palevioletred" + << "lightsteelblue" + << "#000000" + << "#AAAAAA" + << "#FFFFFF" + << "#2AC05F"; + // + // need a different test to do alpha channel test + // << "#AA0011DD" + // << "#00F16B11"; + // +} + +void tst_qdeclarativetextedit::text() +{ + { + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->text(), QString("")); + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->text(), standard.at(i)); + } + + for (int i = 0; i < richText.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QString actual = textEditObject->text(); + QString expected = richText.at(i); + actual.replace(QRegExp(".*<body[^>]*>"),""); + actual.replace(QRegExp("(<[^>]*>)+"),"<>"); + expected.replace(QRegExp("(<[^>]*>)+"),"<>"); + QCOMPARE(actual.simplified(),expected.simplified()); + } +} + +void tst_qdeclarativetextedit::width() +{ + // uses Font metrics to find the width for standard and document to find the width for rich + { + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), 1.);//+1 for cursor + } + + for (int i = 0; i < standard.size(); i++) + { + QFont f; + QFontMetricsF fm(f); + qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); + metricWidth = floor(metricWidth); + + QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character. + } + + for (int i = 0; i < richText.size(); i++) + { + QTextDocument document; + document.setHtml(richText.at(i)); + document.setDocumentMargin(0); + + int documentWidth = document.idealWidth(); + + QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3)); + } +} + +void tst_qdeclarativetextedit::wrap() +{ + // for specified width and wrap set true + { + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), 300.); + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), 300.); + } + + for (int i = 0; i < richText.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->width(), 300.); + } + +} + +void tst_qdeclarativetextedit::textFormat() +{ + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); + QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); + + QVERIFY(textObject != 0); + QVERIFY(textObject->textFormat() == QDeclarativeTextEdit::RichText); + } + { + QDeclarativeComponent textComponent(&engine); + textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); + QDeclarativeTextEdit *textObject = qobject_cast<QDeclarativeTextEdit*>(textComponent.create()); + + QVERIFY(textObject != 0); + QVERIFY(textObject->textFormat() == QDeclarativeTextEdit::PlainText); + } +} + +//the alignment tests may be trivial o.oa +void tst_qdeclarativetextedit::hAlign() +{ + //test one align each, and then test if two align fails. + + for (int i = 0; i < standard.size(); i++) + { + for (int j=0; j < hAlignmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); + } + } + + for (int i = 0; i < richText.size(); i++) + { + for (int j=0; j < hAlignmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); + } + } + +} + +void tst_qdeclarativetextedit::vAlign() +{ + //test one align each, and then test if two align fails. + + for (int i = 0; i < standard.size(); i++) + { + for (int j=0; j < vAlignmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); + } + } + + for (int i = 0; i < richText.size(); i++) + { + for (int j=0; j < vAlignmentStrings.size(); j++) + { + QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); + } + } + +} + +void tst_qdeclarativetextedit::font() +{ + //test size, then bold, then italic, then family + { + QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->font().pointSize(), 40); + QCOMPARE(textEditObject->font().bold(), false); + QCOMPARE(textEditObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->font().bold(), true); + QCOMPARE(textEditObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->font().italic(), true); + QCOMPARE(textEditObject->font().bold(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->font().family(), QString("Helvetica")); + QCOMPARE(textEditObject->font().bold(), false); + QCOMPARE(textEditObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->font().family(), QString("")); + } +} + +void tst_qdeclarativetextedit::color() +{ + //test normal + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i))); + } + + //test selection + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i))); + } + + //test selected text + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i))); + } + + { + QString colorStr = "#AA001234"; + QColor testColor("#001234"); + testColor.setAlpha(170); + + QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->color(), testColor); + } +} + +void tst_qdeclarativetextedit::textMargin() +{ + for(qreal i=0; i<=10; i+=0.3){ + QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->textMargin(), i); + } +} + +void tst_qdeclarativetextedit::persistentSelection() +{ + { + QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->persistentSelection(), true); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->persistentSelection(), false); + } +} + +void tst_qdeclarativetextedit::focusOnPress() +{ + { + QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->focusOnPress(), true); + } + + { + QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + QCOMPARE(textEditObject->focusOnPress(), false); + } +} + +void tst_qdeclarativetextedit::selection() +{ + QString testStr = standard[0];//TODO: What should happen for multiline/rich text? + QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; + QDeclarativeComponent texteditComponent(&engine); + texteditComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit*>(texteditComponent.create()); + QVERIFY(textEditObject != 0); + + + //Test selection follows cursor + for(int i=0; i<= testStr.size(); i++) { + textEditObject->setCursorPosition(i); + QCOMPARE(textEditObject->cursorPosition(), i); + QCOMPARE(textEditObject->selectionStart(), i); + QCOMPARE(textEditObject->selectionEnd(), i); + QVERIFY(textEditObject->selectedText().isNull()); + } + + textEditObject->setCursorPosition(0); + QVERIFY(textEditObject->cursorPosition() == 0); + QVERIFY(textEditObject->selectionStart() == 0); + QVERIFY(textEditObject->selectionEnd() == 0); + QVERIFY(textEditObject->selectedText().isNull()); + + //Test selection + for(int i=0; i<= testStr.size(); i++) { + textEditObject->setSelectionEnd(i); + QCOMPARE(testStr.mid(0,i), textEditObject->selectedText()); + } + for(int i=0; i<= testStr.size(); i++) { + textEditObject->setSelectionStart(i); + QCOMPARE(testStr.mid(i,testStr.size()-i), textEditObject->selectedText()); + } + + textEditObject->setCursorPosition(0); + QVERIFY(textEditObject->cursorPosition() == 0); + QVERIFY(textEditObject->selectionStart() == 0); + QVERIFY(textEditObject->selectionEnd() == 0); + QVERIFY(textEditObject->selectedText().isNull()); + + for(int i=0; i< testStr.size(); i++) { + textEditObject->setSelectionStart(i); + QCOMPARE(textEditObject->selectionEnd(), i); + QCOMPARE(testStr.mid(i,0), textEditObject->selectedText()); + textEditObject->setSelectionEnd(i+1); + QCOMPARE(textEditObject->selectionStart(), i); + QCOMPARE(testStr.mid(i,1), textEditObject->selectedText()); + } + + for(int i= testStr.size() - 1; i>0; i--) { + textEditObject->setSelectionEnd(i); + QCOMPARE(testStr.mid(i,0), textEditObject->selectedText()); + textEditObject->setSelectionStart(i-1); + QCOMPARE(testStr.mid(i-1,1), textEditObject->selectedText()); + } + + //Test Error Ignoring behaviour + textEditObject->setCursorPosition(0); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->setSelectionStart(-10); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->setSelectionStart(100); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->setSelectionEnd(-10); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->setSelectionEnd(100); + QVERIFY(textEditObject->selectedText().isNull()); + textEditObject->setSelectionStart(0); + textEditObject->setSelectionEnd(10); + QVERIFY(textEditObject->selectedText().size() == 10); + textEditObject->setSelectionStart(-10); + QVERIFY(textEditObject->selectedText().size() == 10); + textEditObject->setSelectionStart(100); + QVERIFY(textEditObject->selectedText().size() == 10); + textEditObject->setSelectionEnd(-10); + QVERIFY(textEditObject->selectedText().size() == 10); + textEditObject->setSelectionEnd(100); + QVERIFY(textEditObject->selectedText().size() == 10); +} + +void tst_qdeclarativetextedit::inputMethodHints() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextEdit *textEditObject = qobject_cast<QDeclarativeTextEdit *>(canvas->rootObject()); + QVERIFY(textEditObject != 0); + QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); + textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); + QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); +} + +void tst_qdeclarativetextedit::cursorDelegate() +{ + QDeclarativeView* view = createView(SRCDIR "/data/cursorTest.qml"); + view->show(); + view->setFocus(); + QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); + QVERIFY(textEditObject != 0); + QVERIFY(textEditObject->findChild<QDeclarativeItem*>("cursorInstance")); + //Test Delegate gets created + textEditObject->setFocus(true); + QDeclarativeItem* delegateObject = textEditObject->findChild<QDeclarativeItem*>("cursorInstance"); + QVERIFY(delegateObject); + //Test Delegate gets moved + for(int i=0; i<= textEditObject->text().length(); i++){ + textEditObject->setCursorPosition(i); + QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y())); + } + textEditObject->setCursorPosition(0); + QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x())); + QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y())); + //Test Delegate gets deleted + textEditObject->setCursorDelegate(0); + QVERIFY(!textEditObject->findChild<QDeclarativeItem*>("cursorInstance")); +} + +void tst_qdeclarativetextedit::delegateLoading() +{ + TestHTTPServer server(42332); + server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect); + server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay); + server.serveDirectory(SRCDIR "/data/http"); + QDeclarativeView* view = new QDeclarativeView(0); + view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); + view->show(); + view->setFocus(); + QTRY_VERIFY(view->rootObject());//Wait for loading to finish. + QDeclarativeTextEdit *textEditObject = view->rootObject()->findChild<QDeclarativeTextEdit*>("textEditObject"); + // view->rootObject()->dumpObjectTree(); + QVERIFY(textEditObject != 0); + textEditObject->setFocus(true); + QDeclarativeItem *delegate; + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateOkay"); + QVERIFY(delegate); + delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateSlow"); + QVERIFY(delegate); + view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); + view->show(); + view->setFocus(); + QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test + view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); + view->show(); + 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 + //Not sure how to accomplish this with QDeclarativeTextEdits cursor delegate + //###This could be a case of overzealous defensive programming + //delegate = view->rootObject()->findChild<QDeclarativeItem*>("delegateErrorB"); + //QVERIFY(!delegate); +} + +/* +TextEdit element should only handle left/right keys until the cursor reaches +the extent of the text, then they should ignore the keys. +*/ +void tst_qdeclarativetextedit::navigation() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeItem *input = qobject_cast<QDeclarativeItem *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + QTRY_VERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == true); +} + +void tst_qdeclarativetextedit::readOnly() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/readOnly.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextEdit *edit = qobject_cast<QDeclarativeTextEdit *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); + + QVERIFY(edit != 0); + QTRY_VERIFY(edit->hasFocus() == true); + QVERIFY(edit->isReadOnly() == true); + QString initial = edit->text(); + for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) + simulateKey(canvas, k); + simulateKey(canvas, Qt::Key_Return); + simulateKey(canvas, Qt::Key_Space); + simulateKey(canvas, Qt::Key_Escape); + QCOMPARE(edit->text(), initial); +} + +void tst_qdeclarativetextedit::simulateKey(QDeclarativeView *view, int key) +{ + QKeyEvent press(QKeyEvent::KeyPress, key, 0); + QKeyEvent release(QKeyEvent::KeyRelease, key, 0); + + QApplication::sendEvent(view, &press); + QApplication::sendEvent(view, &release); +} + +QDeclarativeView *tst_qdeclarativetextedit::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + + canvas->setSource(QUrl::fromLocalFile(filename)); + return canvas; +} + +class MyInputContext : public QInputContext +{ +public: + MyInputContext() : softwareInputPanelEventReceived(false) {} + ~MyInputContext() {} + + QString identifierName() { return QString(); } + QString language() { return QString(); } + + void reset() {} + + bool isComposing() const { return false; } + + bool filterEvent( const QEvent *event ) + { + if (event->type() == QEvent::RequestSoftwareInputPanel) + softwareInputPanelEventReceived = true; + return QInputContext::filterEvent(event); + } + bool softwareInputPanelEventReceived; +}; + +void tst_qdeclarativetextedit::sendRequestSoftwareInputPanelEvent() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + MyInputContext ic; + view.viewport()->setInputContext(&ic); + QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( + view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + if ((behavior != QStyle::RSIP_OnMouseClick)) + QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); + QDeclarativeTextEdit edit; + edit.setText("Hello world"); + edit.setPos(0, 0); + scene.addItem(&edit); + view.show(); + qApp->setAutoSipEnabled(true); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); +} +QTEST_MAIN(tst_qdeclarativetextedit) + +#include "tst_qdeclarativetextedit.moc" diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/cursorTest.qml b/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml index ddc98cc..ddc98cc 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/cursorTest.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/cursorTest.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml b/tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml index b404682..b404682 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/inputmethodhints.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/inputmethodhints.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/masks.qml b/tests/auto/declarative/qdeclarativetextinput/data/masks.qml index 08a857c..08a857c 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/masks.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/masks.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/maxLength.qml b/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml index 7cbeadd..7cbeadd 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/maxLength.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/maxLength.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/navigation.qml b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml index 493db5b..493db5b 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/navigation.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/navigation.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/readOnly.qml b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml index c47371a..c47371a 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/readOnly.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/readOnly.qml diff --git a/tests/auto/declarative/qmlgraphicstextinput/data/validators.qml b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml index 0c81548..0c81548 100644 --- a/tests/auto/declarative/qmlgraphicstextinput/data/validators.qml +++ b/tests/auto/declarative/qdeclarativetextinput/data/validators.qml diff --git a/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro new file mode 100644 index 0000000..5aed51f --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/qdeclarativetextinput.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativetextinput.cpp + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp new file mode 100644 index 0000000..8b513e8 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetextinput/tst_qdeclarativetextinput.cpp @@ -0,0 +1,656 @@ +/**************************************************************************** +** +** 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 "../../../shared/util.h" +#include <QtDeclarative/qdeclarativeengine.h> +#include <QFile> +#include <QtDeclarative/qdeclarativeview.h> +#include <private/qdeclarativetextinput_p.h> +#include <QDebug> +#include <QStyle> +#include <QInputContext> + +class tst_qdeclarativetextinput : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativetextinput(); + +private slots: + void text(); + void width(); + void font(); + void color(); + void selection(); + + void maxLength(); + void masks(); + void validators(); + void inputMethodHints(); + + void cursorDelegate(); + void navigation(); + void readOnly(); + + void sendRequestSoftwareInputPanelEvent(); + +private: + void simulateKey(QDeclarativeView *, int key); + QDeclarativeView *createView(const QString &filename); + + QDeclarativeEngine engine; + QStringList standard; + QStringList colorStrings; +}; + +tst_qdeclarativetextinput::tst_qdeclarativetextinput() +{ + standard << "the quick brown fox jumped over the lazy dog" + << "It's supercalifragisiticexpialidocious!" + << "Hello, world!"; + + colorStrings << "aliceblue" + << "antiquewhite" + << "aqua" + << "darkkhaki" + << "darkolivegreen" + << "dimgray" + << "palevioletred" + << "lightsteelblue" + << "#000000" + << "#AAAAAA" + << "#FFFFFF" + << "#2AC05F"; +} + +void tst_qdeclarativetextinput::text() +{ + { + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->text(), QString("")); + } + + for (int i = 0; i < standard.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->text(), standard.at(i)); + } + +} + +void tst_qdeclarativetextinput::width() +{ + // uses Font metrics to find the width for standard + { + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->width(), 1.);//1 for the cursor + } + + for (int i = 0; i < standard.size(); i++) + { + QFont f; + QFontMetricsF fm(f); + qreal metricWidth = fm.width(standard.at(i)); + + QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor + } +} + +void tst_qdeclarativetextinput::font() +{ + //test size, then bold, then italic, then family + { + QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->font().pointSize(), 40); + QCOMPARE(textinputObject->font().bold(), false); + QCOMPARE(textinputObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->font().bold(), true); + QCOMPARE(textinputObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->font().italic(), true); + QCOMPARE(textinputObject->font().bold(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->font().family(), QString("Helvetica")); + QCOMPARE(textinputObject->font().bold(), false); + QCOMPARE(textinputObject->font().italic(), false); + } + + { + QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->font().family(), QString("")); + } +} + +void tst_qdeclarativetextinput::color() +{ + //test color + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); + } + + //test selection color + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); + } + + //test selected text color + for (int i = 0; i < colorStrings.size(); i++) + { + QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); + } + + { + QString colorStr = "#AA001234"; + QColor testColor("#001234"); + testColor.setAlpha(170); + + QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + + QVERIFY(textinputObject != 0); + QCOMPARE(textinputObject->color(), testColor); + } +} + +void tst_qdeclarativetextinput::selection() +{ + QString testStr = standard[0]; + QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; + QDeclarativeComponent textinputComponent(&engine); + textinputComponent.setData(componentStr.toLatin1(), QUrl()); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput*>(textinputComponent.create()); + QVERIFY(textinputObject != 0); + + + //Test selection follows cursor + for(int i=0; i<= testStr.size(); i++) { + textinputObject->setCursorPosition(i); + QCOMPARE(textinputObject->cursorPosition(), i); + QCOMPARE(textinputObject->selectionStart(), i); + QCOMPARE(textinputObject->selectionEnd(), i); + QVERIFY(textinputObject->selectedText().isNull()); + } + + textinputObject->setCursorPosition(0); + QVERIFY(textinputObject->cursorPosition() == 0); + QVERIFY(textinputObject->selectionStart() == 0); + QVERIFY(textinputObject->selectionEnd() == 0); + QVERIFY(textinputObject->selectedText().isNull()); + + //Test selection + for(int i=0; i<= testStr.size(); i++) { + textinputObject->setSelectionEnd(i); + QCOMPARE(testStr.mid(0,i), textinputObject->selectedText()); + } + for(int i=0; i<= testStr.size(); i++) { + textinputObject->setSelectionStart(i); + QCOMPARE(testStr.mid(i,testStr.size()-i), textinputObject->selectedText()); + } + + textinputObject->setCursorPosition(0); + QVERIFY(textinputObject->cursorPosition() == 0); + QVERIFY(textinputObject->selectionStart() == 0); + QVERIFY(textinputObject->selectionEnd() == 0); + QVERIFY(textinputObject->selectedText().isNull()); + + for(int i=0; i< testStr.size(); i++) { + textinputObject->setSelectionStart(i); + QCOMPARE(textinputObject->selectionEnd(), i); + QCOMPARE(testStr.mid(i,0), textinputObject->selectedText()); + textinputObject->setSelectionEnd(i+1); + QCOMPARE(textinputObject->selectionStart(), i); + QCOMPARE(testStr.mid(i,1), textinputObject->selectedText()); + } + + for(int i= testStr.size() - 1; i>0; i--) { + textinputObject->setSelectionEnd(i); + QCOMPARE(testStr.mid(i,0), textinputObject->selectedText()); + textinputObject->setSelectionStart(i-1); + QCOMPARE(testStr.mid(i-1,1), textinputObject->selectedText()); + } + + //Test Error Ignoring behaviour + textinputObject->setCursorPosition(0); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->setSelectionStart(-10); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->setSelectionStart(100); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->setSelectionEnd(-10); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->setSelectionEnd(100); + QVERIFY(textinputObject->selectedText().isNull()); + textinputObject->setSelectionStart(0); + textinputObject->setSelectionEnd(10); + QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->setSelectionStart(-10); + QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->setSelectionStart(100); + QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->setSelectionEnd(-10); + QVERIFY(textinputObject->selectedText().size() == 10); + textinputObject->setSelectionEnd(100); + QVERIFY(textinputObject->selectedText().size() == 10); +} + +void tst_qdeclarativetextinput::maxLength() +{ + //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; + QDeclarativeView *canvas = createView(SRCDIR "/data/maxLength.qml"); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); + QVERIFY(textinputObject != 0); + QVERIFY(textinputObject->text().isEmpty()); + QVERIFY(textinputObject->maxLength() == 10); + foreach(const QString &str, standard){ + QVERIFY(textinputObject->text().length() <= 10); + textinputObject->setText(str); + QVERIFY(textinputObject->text().length() <= 10); + } + + textinputObject->setText(""); + QTRY_VERIFY(textinputObject->hasFocus() == true); + for(int i=0; i<20; i++){ + QCOMPARE(textinputObject->text().length(), qMin(i,10)); + //simulateKey(canvas, Qt::Key_A); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + } +} + +void tst_qdeclarativetextinput::masks() +{ + //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) + //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; + QDeclarativeView *canvas = createView(SRCDIR "/data/masks.qml"); + canvas->show(); + canvas->setFocus(); + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); + QVERIFY(textinputObject != 0); + QTRY_VERIFY(textinputObject->hasFocus() == true); + QVERIFY(textinputObject->text().length() == 0); + QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); + for(int i=0; i<10; i++){ + QCOMPARE(qMin(i,8), textinputObject->text().length()); + QCOMPARE(i>=4, textinputObject->hasAcceptableInput()); + //simulateKey(canvas, Qt::Key_A); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + } +} + +void tst_qdeclarativetextinput::validators() +{ + // Note that this test assumes that the validators are working properly + // so you may need to run their tests first. All validators are checked + // here to ensure that their exposure to QML is working. + + QDeclarativeView *canvas = createView(SRCDIR "/data/validators.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *intInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("intInput"))); + QVERIFY(intInput); + intInput->setFocus(true); + QTRY_VERIFY(intInput->hasFocus()); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(intInput->text(), QLatin1String("1")); + QCOMPARE(intInput->hasAcceptableInput(), false); + QTest::keyPress(canvas, Qt::Key_2); + QTest::keyRelease(canvas, Qt::Key_2, Qt::NoModifier ,10); + QCOMPARE(intInput->text(), QLatin1String("1")); + QCOMPARE(intInput->hasAcceptableInput(), false); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(intInput->text(), QLatin1String("11")); + QCOMPARE(intInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_0); + QTest::keyRelease(canvas, Qt::Key_0, Qt::NoModifier ,10); + QCOMPARE(intInput->text(), QLatin1String("11")); + QCOMPARE(intInput->hasAcceptableInput(), true); + + QDeclarativeTextInput *dblInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("dblInput"))); + QTRY_VERIFY(dblInput); + dblInput->setFocus(true); + QVERIFY(dblInput->hasFocus() == true); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("1")); + QCOMPARE(dblInput->hasAcceptableInput(), false); + QTest::keyPress(canvas, Qt::Key_2); + QTest::keyRelease(canvas, Qt::Key_2, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("12")); + QCOMPARE(dblInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_Period); + QTest::keyRelease(canvas, Qt::Key_Period, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("12.")); + QCOMPARE(dblInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("12.1")); + QCOMPARE(dblInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("12.11")); + QCOMPARE(dblInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QCOMPARE(dblInput->text(), QLatin1String("12.11")); + QCOMPARE(dblInput->hasAcceptableInput(), true); + + QDeclarativeTextInput *strInput = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("strInput"))); + QTRY_VERIFY(strInput); + strInput->setFocus(true); + QVERIFY(strInput->hasFocus() == true); + QTest::keyPress(canvas, Qt::Key_1); + QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); + QEXPECT_FAIL("","Will not work until QTBUG-8025 is resolved", Abort); + QCOMPARE(strInput->text(), QLatin1String("")); + QCOMPARE(strInput->hasAcceptableInput(), false); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(strInput->text(), QLatin1String("a")); + QCOMPARE(strInput->hasAcceptableInput(), false); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(strInput->text(), QLatin1String("aa")); + QCOMPARE(strInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(strInput->text(), QLatin1String("aaa")); + QCOMPARE(strInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(strInput->text(), QLatin1String("aaaa")); + QCOMPARE(strInput->hasAcceptableInput(), true); + QTest::keyPress(canvas, Qt::Key_A); + QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); + QCOMPARE(strInput->text(), QLatin1String("aaaa")); + QCOMPARE(strInput->hasAcceptableInput(), true); +} + +void tst_qdeclarativetextinput::inputMethodHints() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + QDeclarativeTextInput *textinputObject = qobject_cast<QDeclarativeTextInput *>(canvas->rootObject()); + QVERIFY(textinputObject != 0); + QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText); + textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly); + QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly); +} + +/* +TextInput element should only handle left/right keys until the cursor reaches +the extent of the text, then they should ignore the keys. + +*/ +void tst_qdeclarativetextinput::navigation() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/navigation.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + input->setCursorPosition(0); + QTRY_VERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == true); + //QT-2944: If text is selected, then we should deselect first. + input->setCursorPosition(input->text().length()); + input->setSelectionStart(0); + input->setSelectionEnd(input->text().length()); + QVERIFY(input->selectionStart() != input->selectionEnd()); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->selectionStart() == input->selectionEnd()); + QVERIFY(input->selectionStart() == input->text().length()); + QVERIFY(input->hasFocus() == true); + simulateKey(canvas, Qt::Key_Right); + QVERIFY(input->hasFocus() == false); + simulateKey(canvas, Qt::Key_Left); + QVERIFY(input->hasFocus() == true); +} + +void tst_qdeclarativetextinput::cursorDelegate() +{ + QDeclarativeView* view = createView(SRCDIR "/data/cursorTest.qml"); + view->show(); + view->setFocus(); + QDeclarativeTextInput *textInputObject = view->rootObject()->findChild<QDeclarativeTextInput*>("textInputObject"); + QVERIFY(textInputObject != 0); + QVERIFY(textInputObject->findChild<QDeclarativeItem*>("cursorInstance")); + //Test Delegate gets created + textInputObject->setFocus(true); + QDeclarativeItem* delegateObject = textInputObject->findChild<QDeclarativeItem*>("cursorInstance"); + QVERIFY(delegateObject); + //Test Delegate gets moved + for(int i=0; i<= textInputObject->text().length(); i++){ + textInputObject->setCursorPosition(i); + //+5 is because the TextInput cursorRect is just a 10xHeight area centered on cursor position + QCOMPARE(textInputObject->cursorRect().x() + 5, qRound(delegateObject->x())); + QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); + } + textInputObject->setCursorPosition(0); + QCOMPARE(textInputObject->cursorRect().x()+5, qRound(delegateObject->x())); + QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); + //Test Delegate gets deleted + textInputObject->setCursorDelegate(0); + QVERIFY(!textInputObject->findChild<QDeclarativeItem*>("cursorInstance")); +} + +void tst_qdeclarativetextinput::readOnly() +{ + QDeclarativeView *canvas = createView(SRCDIR "/data/readOnly.qml"); + canvas->show(); + canvas->setFocus(); + + QVERIFY(canvas->rootObject() != 0); + + QDeclarativeTextInput *input = qobject_cast<QDeclarativeTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); + + QVERIFY(input != 0); + QTRY_VERIFY(input->hasFocus() == true); + QVERIFY(input->isReadOnly() == true); + QString initial = input->text(); + for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) + simulateKey(canvas, k); + simulateKey(canvas, Qt::Key_Return); + simulateKey(canvas, Qt::Key_Space); + simulateKey(canvas, Qt::Key_Escape); + QCOMPARE(input->text(), initial); +} + +void tst_qdeclarativetextinput::simulateKey(QDeclarativeView *view, int key) +{ + QKeyEvent press(QKeyEvent::KeyPress, key, 0); + QKeyEvent release(QKeyEvent::KeyRelease, key, 0); + + QApplication::sendEvent(view, &press); + QApplication::sendEvent(view, &release); +} + +QDeclarativeView *tst_qdeclarativetextinput::createView(const QString &filename) +{ + QDeclarativeView *canvas = new QDeclarativeView(0); + + canvas->setSource(QUrl::fromLocalFile(filename)); + + return canvas; +} + +class MyInputContext : public QInputContext +{ +public: + MyInputContext() : softwareInputPanelEventReceived(false) {} + ~MyInputContext() {} + + QString identifierName() { return QString(); } + QString language() { return QString(); } + + void reset() {} + + bool isComposing() const { return false; } + + bool filterEvent( const QEvent *event ) + { + if (event->type() == QEvent::RequestSoftwareInputPanel) + softwareInputPanelEventReceived = true; + return QInputContext::filterEvent(event); + } + bool softwareInputPanelEventReceived; +}; + +void tst_qdeclarativetextinput::sendRequestSoftwareInputPanelEvent() +{ + QGraphicsScene scene; + QGraphicsView view(&scene); + MyInputContext ic; + view.viewport()->setInputContext(&ic); + QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( + view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); + if ((behavior != QStyle::RSIP_OnMouseClick)) + QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); + QDeclarativeTextInput input; + input.setText("Hello world"); + input.setPos(0, 0); + scene.addItem(&input); + view.show(); + qApp->setAutoSipEnabled(true); + QApplication::setActiveWindow(&view); + QTest::qWaitForWindowShown(&view); + QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); + QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); + QApplication::processEvents(); + QCOMPARE(ic.softwareInputPanelEventReceived, true); +} + +QTEST_MAIN(tst_qdeclarativetextinput) + +#include "tst_qdeclarativetextinput.moc" diff --git a/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro new file mode 100644 index 0000000..b162739 --- /dev/null +++ b/tests/auto/declarative/qdeclarativetimer/qdeclarativetimer.pro @@ -0,0 +1,7 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativetimer.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp new file mode 100644 index 0000000..b120d5d --- /dev/null +++ b/tests/auto/declarative/qdeclarativetimer/tst_qdeclarativetimer.cpp @@ -0,0 +1,285 @@ +/**************************************************************************** +** +** 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 <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativetimer_p.h> +#include <QDebug> + +class tst_qdeclarativetimer : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativetimer(); + +private slots: + void notRepeating(); + void notRepeatingStart(); + void repeat(); + void noTriggerIfNotRunning(); + void triggeredOnStart(); + void triggeredOnStartRepeat(); + void changeDuration(); + void restart(); +}; + +class TimerHelper : public QObject +{ + Q_OBJECT +public: + TimerHelper() : QObject(), count(0) + { + } + + int count; + +public slots: + void timeout() { + ++count; + } +}; + +#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) +// Increase wait as emulator startup can cause unexpected delays +#define TIMEOUT_TIMEOUT 2000 +#else +#define TIMEOUT_TIMEOUT 200 +#endif + +tst_qdeclarativetimer::tst_qdeclarativetimer() +{ +} + +void tst_qdeclarativetimer::notRepeating() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + QVERIFY(timer->isRunning()); + QVERIFY(!timer->isRepeating()); + QCOMPARE(timer->interval(), 100); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 1); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 1); + QVERIFY(timer->isRunning() == false); +} + +void tst_qdeclarativetimer::notRepeatingStart() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + QVERIFY(!timer->isRunning()); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 0); + + timer->start(); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 1); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 1); + QVERIFY(timer->isRunning() == false); + + delete timer; +} + +void tst_qdeclarativetimer::repeat() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + QCOMPARE(helper.count, 0); + + QTest::qWait(TIMEOUT_TIMEOUT); + QVERIFY(helper.count > 0); + int oldCount = helper.count; + + QTest::qWait(TIMEOUT_TIMEOUT); + QVERIFY(helper.count > oldCount); + QVERIFY(timer->isRunning()); + + oldCount = helper.count; + timer->stop(); + + QTest::qWait(TIMEOUT_TIMEOUT); + QVERIFY(helper.count == oldCount); + QVERIFY(timer->isRunning() == false); + + delete timer; +} + +void tst_qdeclarativetimer::triggeredOnStart() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + QVERIFY(timer->triggeredOnStart()); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + QTest::qWait(1); + QCOMPARE(helper.count, 1); + + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 2); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(helper.count, 2); + QVERIFY(timer->isRunning() == false); + + delete timer; +} + +void tst_qdeclarativetimer::triggeredOnStartRepeat() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + QTest::qWait(1); + QCOMPARE(helper.count, 1); + + QTest::qWait(TIMEOUT_TIMEOUT); + QVERIFY(helper.count > 1); + int oldCount = helper.count; + QTest::qWait(TIMEOUT_TIMEOUT); + QVERIFY(helper.count > oldCount); + QVERIFY(timer->isRunning()); + + delete timer; +} + +void tst_qdeclarativetimer::noTriggerIfNotRunning() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray( + "import Qt 4.6\n" + "Item { property bool ok: true\n" + "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" + "Timer { interval: 10; running: true; onTriggered: t1.running=false }" + "}" + ), QUrl::fromLocalFile("")); + QObject *item = component.create(); + QVERIFY(item != 0); + QTest::qWait(TIMEOUT_TIMEOUT); + QCOMPARE(item->property("ok").toBool(), true); + + delete item; +} + +void tst_qdeclarativetimer::changeDuration() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + QCOMPARE(helper.count, 0); + + QTest::qWait(500); + QCOMPARE(helper.count, 2); + + timer->setInterval(500); + + QTest::qWait(600); + QCOMPARE(helper.count, 3); + QVERIFY(timer->isRunning()); + + delete timer; +} + +void tst_qdeclarativetimer::restart() +{ + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine); + component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); + QDeclarativeTimer *timer = qobject_cast<QDeclarativeTimer*>(component.create()); + QVERIFY(timer != 0); + + TimerHelper helper; + connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); + QCOMPARE(helper.count, 0); + + QTest::qWait(600); + QCOMPARE(helper.count, 1); + + QTest::qWait(300); + + timer->restart(); + + QTest::qWait(700); + + QCOMPARE(helper.count, 2); + QVERIFY(timer->isRunning()); + + delete timer; +} + +QTEST_MAIN(tst_qdeclarativetimer) + +#include "tst_qdeclarativetimer.moc" diff --git a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml index ce2e82d..ce2e82d 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.2.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.2.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml index c82b533..c82b533 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.3.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml index a8a72f5..a8a72f5 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/autoBindingRemoval.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/autoBindingRemoval.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/bindingAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml index a652186..a652186 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/bindingAssignment.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingAssignment.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/bindingConflict.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml index fd25c9f..fd25c9f 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/bindingConflict.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingConflict.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/bindingRead.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml index 538d776..538d776 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/bindingRead.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingRead.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/bindingVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml index 691a56c..691a56c 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/bindingVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/bindingVariantCopy.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/deletedObject.js b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.js index af298ff..af298ff 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/deletedObject.js +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.js diff --git a/tests/auto/declarative/qmlvaluetypes/data/deletedObject.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml index 05459f4..05459f4 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/deletedObject.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/deletedObject.qml diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml new file mode 100644 index 0000000..0eadd50 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.1.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: "MixedCase" +} + diff --git a/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml new file mode 100644 index 0000000..81f1c92 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/enums.2.qml @@ -0,0 +1,6 @@ +import Test 1.0 + +MyTypeObject { + font.capitalization: if (1) "MixedCase" +} + diff --git a/tests/auto/declarative/qmlvaluetypes/data/font_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml index e1d1ce0..e1d1ce0 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/font_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/font_write.2.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.2.qml index b559389..b559389 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/font_write.2.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.2.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/font_write.3.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml index 913ac50..913ac50 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/font_write.3.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.3.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/font_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.qml index ff4d0a1..ff4d0a1 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/font_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/font_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/point_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml index 3e67de6..3e67de6 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/point_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/point_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/point_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/point_write.qml index 063525a..063525a 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/point_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/point_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/pointf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml index d845a5b..d845a5b 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/pointf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/pointf_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_write.qml index 9ee3fc1..9ee3fc1 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/pointf_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/pointf_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/rect_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml index 5364431..5364431 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/rect_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/rect_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_write.qml index 8add453..8add453 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/rect_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rect_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/rectf_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml index aeb9f41..aeb9f41 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/rectf_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/rectf_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_write.qml index 1e6ff4f..1e6ff4f 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/rectf_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/rectf_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/scriptAccess.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml index 96592eb..96592eb 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/scriptAccess.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptAccess.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/scriptVariantCopy.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml index 29157e8..29157e8 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/scriptVariantCopy.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/scriptVariantCopy.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/size_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml index 86dba03..86dba03 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/size_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/size_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/size_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/size_write.qml index 2f9d10e..2f9d10e 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/size_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/size_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/sizef_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml index c6f34e4..c6f34e4 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/sizef_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/sizef_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_write.qml index f16f0bd..f16f0bd 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/sizef_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/sizef_write.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/staticAssignment.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml index b687f89..b687f89 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/staticAssignment.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/staticAssignment.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/valueInterceptors.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml index 026ae83..026ae83 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/valueInterceptors.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueInterceptors.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/valueSources.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml index d4d4391..d4d4391 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/valueSources.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/valueSources.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/vector3d_read.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml index abdf9f0..abdf9f0 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/vector3d_read.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_read.qml diff --git a/tests/auto/declarative/qmlvaluetypes/data/vector3d_write.qml b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_write.qml index 9c1bf76..9c1bf76 100644 --- a/tests/auto/declarative/qmlvaluetypes/data/vector3d_write.qml +++ b/tests/auto/declarative/qdeclarativevaluetypes/data/vector3d_write.qml diff --git a/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro new file mode 100644 index 0000000..028fc57 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/qdeclarativevaluetypes.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative +macx:CONFIG -= app_bundle + +HEADERS += testtypes.h + +SOURCES += tst_qdeclarativevaluetypes.cpp \ + testtypes.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp new file mode 100644 index 0000000..aa8bd6e --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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 registerTypes() +{ + QML_REGISTER_TYPE(Test, 1, 0, MyTypeObject, MyTypeObject); + QML_REGISTER_TYPE(Test, 1, 0, MyConstantValueSource, MyConstantValueSource); + QML_REGISTER_TYPE(Test, 1, 0, MyOffsetValueInterceptor, MyOffsetValueInterceptor); +} diff --git a/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h new file mode 100644 index 0000000..dfc2829 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/testtypes.h @@ -0,0 +1,156 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <QObject> +#include <QPoint> +#include <QPointF> +#include <QSize> +#include <QSizeF> +#include <QRect> +#include <QRectF> +#include <QVector3D> +#include <QFont> +#include <qdeclarative.h> +#include <QDeclarativePropertyValueSource> +#include <QDeclarativeProperty> +#include <private/qdeclarativeproperty_p.h> + +class MyTypeObject : public QObject +{ + Q_OBJECT + + Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed); + Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed); + Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed); + Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed); + Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed); + Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed); + Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed); + Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed); + +public: + MyTypeObject() : + m_point(10, 4), + m_pointf(11.3, -10.9), + m_size(1912, 1913), + m_sizef(0.1, 100923.2), + m_rect(2, 3, 109, 102), + m_rectf(103.8, 99.2, 88.1, 77.6), + m_vector(23.88, 3.1, 4.3) + { + m_font.setFamily("Arial"); + m_font.setBold(true); + m_font.setWeight(QFont::DemiBold); + m_font.setItalic(true); + m_font.setUnderline(true); + m_font.setOverline(true); + m_font.setStrikeOut(true); + m_font.setPointSize(29); + m_font.setCapitalization(QFont::AllUppercase); + m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2); + m_font.setWordSpacing(19.7); + } + + QPoint m_point; + QPoint point() const { return m_point; } + void setPoint(const QPoint &v) { m_point = v; emit changed(); } + + QPointF m_pointf; + QPointF pointf() const { return m_pointf; } + void setPointf(const QPointF &v) { m_pointf = v; emit changed(); } + + QSize m_size; + QSize size() const { return m_size; } + void setSize(const QSize &v) { m_size = v; emit changed(); } + + QSizeF m_sizef; + QSizeF sizef() const { return m_sizef; } + void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); } + + QRect m_rect; + QRect rect() const { return m_rect; } + void setRect(const QRect &v) { m_rect = v; emit changed(); } + + QRectF m_rectf; + QRectF rectf() const { return m_rectf; } + void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } + + QVector3D m_vector; + QVector3D vector() const { return m_vector; } + void setVector(const QVector3D &v) { m_vector = v; emit changed(); } + + QFont m_font; + QFont font() const { return m_font; } + void setFont(const QFont &v) { m_font = v; emit changed(); } + + void emitRunScript() { emit runScript(); } + +signals: + void changed(); + void runScript(); +}; +QML_DECLARE_TYPE(MyTypeObject); + +class MyConstantValueSource : public QObject, public QDeclarativePropertyValueSource +{ + Q_OBJECT +public: + virtual void setTarget(const QDeclarativeProperty &p) { p.write(3345); } +}; +QML_DECLARE_TYPE(MyConstantValueSource); + +class MyOffsetValueInterceptor : public QObject, public QDeclarativePropertyValueInterceptor +{ + Q_OBJECT +public: + virtual void setTarget(const QDeclarativeProperty &p) { prop = p; } + virtual void write(const QVariant &value) { QDeclarativePropertyPrivate::write(prop, value.toInt() + 13, QDeclarativePropertyPrivate::BypassInterceptor); } + +private: + QDeclarativeProperty prop; +}; +QML_DECLARE_TYPE(MyOffsetValueInterceptor); + +void registerTypes(); + +#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp new file mode 100644 index 0000000..69646b9 --- /dev/null +++ b/tests/auto/declarative/qdeclarativevaluetypes/tst_qdeclarativevaluetypes.cpp @@ -0,0 +1,616 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDebug> +#include <private/qdeclarativevaluetype_p.h> +#include "testtypes.h" + +class tst_qdeclarativevaluetypes : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativevaluetypes() {} + +private slots: + void initTestCase(); + + void point(); + void pointf(); + void size(); + void sizef(); + void rect(); + void rectf(); + void vector3d(); + void font(); + + void bindingAssignment(); + void bindingRead(); + void staticAssignment(); + void scriptAccess(); + void autoBindingRemoval(); + void valueSources(); + void valueInterceptors(); + void bindingConflict(); + void deletedObject(); + void bindingVariantCopy(); + void scriptVariantCopy(); + void cppClasses(); + void enums(); + +private: + QDeclarativeEngine engine; +}; + +void tst_qdeclarativevaluetypes::initTestCase() +{ + registerTypes(); +} + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +void tst_qdeclarativevaluetypes::point() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("point_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("p_x").toInt(), 10); + QCOMPARE(object->property("p_y").toInt(), 4); + QCOMPARE(object->property("copy"), QVariant(QPoint(10, 4))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("point_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->point(), QPoint(11, 12)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::pointf() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("pointf_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("p_x").toDouble(), 11.3); + QCOMPARE(object->property("p_y").toDouble(), -10.9); + QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("pointf_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->pointf(), QPointF(6.8, 9.3)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::size() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("size_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("s_width").toInt(), 1912); + QCOMPARE(object->property("s_height").toInt(), 1913); + QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("size_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->size(), QSize(13, 88)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::sizef() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("sizef_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("s_width").toDouble(), 0.1); + QCOMPARE(object->property("s_height").toDouble(), 100923.2); + QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("sizef_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->sizef(), QSizeF(44.3, 92.8)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::rect() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("rect_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("r_x").toInt(), 2); + QCOMPARE(object->property("r_y").toInt(), 3); + QCOMPARE(object->property("r_width").toInt(), 109); + QCOMPARE(object->property("r_height").toInt(), 102); + QCOMPARE(object->property("copy"), QVariant(QRect(2, 3, 109, 102))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("rect_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect(), QRect(1234, 7, 56, 63)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::rectf() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("rectf_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("r_x").toDouble(), 103.8); + QCOMPARE(object->property("r_y").toDouble(), 99.2); + QCOMPARE(object->property("r_width").toDouble(), 88.1); + QCOMPARE(object->property("r_height").toDouble(), 77.6); + QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("rectf_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rectf(), QRectF(70.1, -113.2, 80924.8, 99.2)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::vector3d() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("vector3d_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88); + QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1); + QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3); + QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3))); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("vector3d_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4)); + + delete object; + } +} + +void tst_qdeclarativevaluetypes::font() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("font_read.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("f_family").toString(), object->font().family()); + QCOMPARE(object->property("f_bold").toBool(), object->font().bold()); + QCOMPARE(object->property("f_weight").toInt(), object->font().weight()); + QCOMPARE(object->property("f_italic").toBool(), object->font().italic()); + QCOMPARE(object->property("f_underline").toBool(), object->font().underline()); + QCOMPARE(object->property("f_overline").toBool(), object->font().overline()); + QCOMPARE(object->property("f_strikeout").toBool(), object->font().strikeOut()); + QCOMPARE(object->property("f_pointSize").toDouble(), object->font().pointSizeF()); + QCOMPARE(object->property("f_pixelSize").toInt(), object->font().pixelSize()); + QCOMPARE(object->property("f_capitalization").toInt(), (int)object->font().capitalization()); + QCOMPARE(object->property("f_letterSpacing").toDouble(), object->font().letterSpacing()); + QCOMPARE(object->property("f_wordSpacing").toDouble(), object->font().wordSpacing()); + + QCOMPARE(object->property("copy"), QVariant(object->font())); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("font_write.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QFont font; + font.setFamily("Helvetica"); + font.setBold(false); + font.setWeight(QFont::Normal); + font.setItalic(false); + font.setUnderline(false); + font.setStrikeOut(false); + font.setPointSize(15); + font.setCapitalization(QFont::AllLowercase); + font.setLetterSpacing(QFont::AbsoluteSpacing, 9.7); + font.setWordSpacing(11.2); + + QEXPECT_FAIL("", "QT-2920", Continue); + QCOMPARE(object->font(), font); + + delete object; + } + + // Test pixelSize + { + QDeclarativeComponent component(&engine, TEST_FILE("font_write.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->font().pixelSize(), 10); + + delete object; + } + + // Test pixelSize and pointSize + { + QDeclarativeComponent component(&engine, TEST_FILE("font_write.3.qml")); + QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->font().pixelSize(), 10); + + delete object; + } +} + +// Test bindings can write to value types +void tst_qdeclarativevaluetypes::bindingAssignment() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bindingAssignment.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(92)); + + QCOMPARE(object->rect().x(), 92); + + delete object; +} + +// Test bindings can read from value types +void tst_qdeclarativevaluetypes::bindingRead() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bindingRead.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("value").toInt(), 2); + + object->setRect(QRect(19, 3, 88, 2)); + + QCOMPARE(object->property("value").toInt(), 19); + + delete object; +} + +// Test static values can assign to value types +void tst_qdeclarativevaluetypes::staticAssignment() +{ + QDeclarativeComponent component(&engine, TEST_FILE("staticAssignment.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 9); + + delete object; +} + +// Test scripts can read/write value types +void tst_qdeclarativevaluetypes::scriptAccess() +{ + QDeclarativeComponent component(&engine, TEST_FILE("scriptAccess.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->property("valuePre").toInt(), 2); + QCOMPARE(object->rect().x(), 19); + QCOMPARE(object->property("valuePost").toInt(), 19); + + delete object; +} + +// Test that assigning a constant from script removes any binding +void tst_qdeclarativevaluetypes::autoBindingRemoval() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(13)); + + QCOMPARE(object->rect().x(), 13); + + object->emitRunScript(); + + QCOMPARE(object->rect().x(), 42); + + object->setProperty("value", QVariant(92)); + + QEXPECT_FAIL("", "QT-2920", Continue); + QCOMPARE(object->rect().x(), 42); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 10); + + object->setProperty("value", QVariant(13)); + + QCOMPARE(object->rect().x(), 13); + + object->emitRunScript(); + + QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); + + object->setProperty("value", QVariant(92)); + + QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("autoBindingRemoval.3.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + object->setProperty("value", QVariant(QRect(9, 22, 33, 44))); + + QCOMPARE(object->rect(), QRect(9, 22, 33, 44)); + + object->emitRunScript(); + + QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); + + object->setProperty("value", QVariant(QRect(19, 3, 4, 8))); + + QEXPECT_FAIL("", "QT-2920", Continue); + QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); + + delete object; + } + +} + +// Test that property value sources assign to value types +void tst_qdeclarativevaluetypes::valueSources() +{ + QDeclarativeComponent component(&engine, TEST_FILE("valueSources.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect().x(), 3345); + + delete object; +} + +static void checkNoErrors(QDeclarativeComponent& component) +{ + QList<QDeclarativeError> errors = component.errors(); + if (errors.isEmpty()) + return; + for (int ii = 0; ii < errors.count(); ++ii) { + const QDeclarativeError &error = errors.at(ii); + qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData()); + } +} + +// Test that property value interceptors can be applied to value types +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); + + object->setProperty("value", 99); + + QCOMPARE(object->rect().x(), 112); + + delete object; +} + +// Test that you can't assign a binding to the "root" value type, and a sub-property +void tst_qdeclarativevaluetypes::bindingConflict() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bindingConflict.qml")); + QCOMPARE(component.isError(), true); +} + +#define CPP_TEST(type, v) \ +{ \ + type *t = new type; \ + QVariant value(v); \ + t->setValue(value); \ + QCOMPARE(t->value(), value); \ + delete t; \ +} + +// Test that accessing a reference to a valuetype after the owning object is deleted +// doesn't crash +void tst_qdeclarativevaluetypes::deletedObject() +{ + QDeclarativeComponent component(&engine, TEST_FILE("deletedObject.qml")); + QTest::ignoreMessage(QtDebugMsg, "Test: 2"); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QObject *dObject = qvariant_cast<QObject *>(object->property("object")); + QVERIFY(dObject != 0); + delete dObject; + + QTest::ignoreMessage(QtDebugMsg, "Test: undefined"); + object->emitRunScript(); + + delete object; +} + +// Test that value types can be assigned to another value type property in a binding +void tst_qdeclarativevaluetypes::bindingVariantCopy() +{ + QDeclarativeComponent component(&engine, TEST_FILE("bindingVariantCopy.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); + + delete object; +} + +// Test that value types can be assigned to another value type property in script +void tst_qdeclarativevaluetypes::scriptVariantCopy() +{ + QDeclarativeComponent component(&engine, TEST_FILE("scriptVariantCopy.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + + QCOMPARE(object->rect(), QRect(2, 3, 109, 102)); + + object->emitRunScript(); + + QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); + + delete object; +} + + +// Test that the value type classes can be used manually +void tst_qdeclarativevaluetypes::cppClasses() +{ + CPP_TEST(QDeclarativePointValueType, QPoint(19, 33)); + CPP_TEST(QDeclarativePointFValueType, QPointF(33.6, -23)); + CPP_TEST(QDeclarativeSizeValueType, QSize(-100, 18)); + CPP_TEST(QDeclarativeSizeFValueType, QSizeF(-100.7, 18.2)); + CPP_TEST(QDeclarativeRectValueType, QRect(13, 39, 10928, 88)); + CPP_TEST(QDeclarativeRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); + CPP_TEST(QDeclarativeVector3DValueType, QVector3D(18.2, 19.7, 1002)); + CPP_TEST(QDeclarativeFontValueType, QFont("Helvetica")); + +} + +void tst_qdeclarativevaluetypes::enums() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("enums.1.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("enums.2.qml")); + MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); + QVERIFY(object != 0); + QVERIFY(object->font().capitalization() == QFont::MixedCase); + delete object; + } +} + +QTEST_MAIN(tst_qdeclarativevaluetypes) + +#include "tst_qdeclarativevaluetypes.moc" diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.html b/tests/auto/declarative/qdeclarativewebview/data/basic.html index 22e3e24..22e3e24 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/basic.html +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.html diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.ico b/tests/auto/declarative/qdeclarativewebview/data/basic.ico Binary files differindex 8f3d05e..8f3d05e 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/basic.ico +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.ico diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.png b/tests/auto/declarative/qdeclarativewebview/data/basic.png Binary files differindex 35717cc..35717cc 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/basic.png +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.png diff --git a/tests/auto/declarative/qmlgraphicswebview/data/basic.qml b/tests/auto/declarative/qdeclarativewebview/data/basic.qml index 5394837..5394837 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/basic.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/basic.qml diff --git a/tests/auto/declarative/qmlgraphicswebview/data/elements.html b/tests/auto/declarative/qdeclarativewebview/data/elements.html index 9236867..9236867 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/elements.html +++ b/tests/auto/declarative/qdeclarativewebview/data/elements.html diff --git a/tests/auto/declarative/qmlgraphicswebview/data/elements.qml b/tests/auto/declarative/qdeclarativewebview/data/elements.qml index 7c030e6..7c030e6 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/elements.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/elements.qml diff --git a/tests/auto/declarative/qdeclarativewebview/data/forward.html b/tests/auto/declarative/qdeclarativewebview/data/forward.html new file mode 100644 index 0000000..62ab62d --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/data/forward.html @@ -0,0 +1,12 @@ +<html> +<head><title>Forward</title> +<link rel="icon" sizes="32x32" href="forward.png"> +</head> +<body leftmargin="0" marginwidth="0"> +<table width="123"> +<tbody> +<tr><td>This is more.</td></tr> +</tbody> +</table> +</body> +</html> diff --git a/tests/auto/declarative/qmlgraphicswebview/data/javaScript.html b/tests/auto/declarative/qdeclarativewebview/data/javaScript.html index 35270bc..35270bc 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/javaScript.html +++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.html diff --git a/tests/auto/declarative/qmlgraphicswebview/data/javaScript.qml b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml index 07eee88..07eee88 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/javaScript.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/javaScript.qml diff --git a/tests/auto/declarative/qmlgraphicswebview/data/loadError.qml b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml index 1460f30..1460f30 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/loadError.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/loadError.qml diff --git a/tests/auto/declarative/qmlgraphicswebview/data/newwindows.html b/tests/auto/declarative/qdeclarativewebview/data/newwindows.html index dd541f9..dd541f9 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/newwindows.html +++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.html diff --git a/tests/auto/declarative/qmlgraphicswebview/data/newwindows.qml b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml index 0bc8263..0bc8263 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/newwindows.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/newwindows.qml diff --git a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html b/tests/auto/declarative/qdeclarativewebview/data/pixelCache.html index 9412674..9412674 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.html +++ b/tests/auto/declarative/qdeclarativewebview/data/pixelCache.html diff --git a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml b/tests/auto/declarative/qdeclarativewebview/data/pixelCache.qml index 08e4d65..08e4d65 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/pixelCache.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/pixelCache.qml diff --git a/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml new file mode 100644 index 0000000..3dd4e51 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/data/propertychanges.qml @@ -0,0 +1,33 @@ +import Qt 4.6 + +Item { + width: 240 + height: 160 + Grid { + anchors.fill: parent + objectName: "newWindowParent" + id: newWindowParent + } + + Row { + anchors.fill: parent + id: oldWindowParent + objectName: "oldWindowParent" + } + + Loader { + sourceComponent: webViewComponent + } + Component { + id: webViewComponent + WebView { + id: webView + objectName: "webView" + newWindowComponent: webViewComponent + newWindowParent: oldWindowParent + url: "basic.html" + renderingEnabled: true + pressGrabTime: 200 + } + } +}
\ No newline at end of file diff --git a/tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml index 063b5a8..063b5a8 100644 --- a/tests/auto/declarative/qmlgraphicswebview/data/sethtml.qml +++ b/tests/auto/declarative/qdeclarativewebview/data/sethtml.qml diff --git a/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro new file mode 100644 index 0000000..6af0a60 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/qdeclarativewebview.pro @@ -0,0 +1,10 @@ +load(qttest_p4) +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 + +# 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 new file mode 100644 index 0000000..7efc214 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/testtypes.cpp @@ -0,0 +1,52 @@ +/**************************************************************************** +** +** 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/testtypes.h b/tests/auto/declarative/qdeclarativewebview/testtypes.h new file mode 100644 index 0000000..8eb703f --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/testtypes.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <private/qdeclarativewebview_p.h> + +class MyWebView : public QDeclarativeWebView +{ + Q_OBJECT + Q_PROPERTY(int pixelsPainted READ pixelsPainted); + +public: + MyWebView() : pp(0) {} + + int pixelsPainted() const { return pp; } + + void drawContents(QPainter *p, const QRect &r); + +private: + int pp; +}; + +QML_DECLARE_TYPE(MyWebView); + +void registerTypes(); + +#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp new file mode 100644 index 0000000..6d16056 --- /dev/null +++ b/tests/auto/declarative/qdeclarativewebview/tst_qdeclarativewebview.cpp @@ -0,0 +1,513 @@ +/**************************************************************************** +** +** 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 <QtTest/QSignalSpy> +#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 +{ + Q_OBJECT +public: + tst_qdeclarativewebview() {} + +private slots: + void initTestCase(); + void basicProperties(); + void settings(); + void historyNav(); + void multipleWindows(); + void elementAreaAt(); + void loadError(); + void setHtml(); + void javaScript(); + void cleanupTestCase(); + void pixelCache(); + void newWindowParent(); + void newWindowComponent(); + void renderingEnabled(); + void pressGrabTime(); + +private: + void checkNoErrors(const QDeclarativeComponent& component); + QDeclarativeEngine engine; + QString tmpDir() const + { + static QString tmpd = QDir::tempPath()+"/tst_qdeclarativewebview-" + + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); + return tmpd; + } +}; + +void tst_qdeclarativewebview::initTestCase() +{ + registerTypes(); +} + +static QString strippedHtml(QString html) +{ + html.replace(QRegExp("\\s+"),""); + return html; +} + +static QString fileContents(const QString& filename) +{ + QFile file(filename); + file.open(QIODevice::ReadOnly); + return QString::fromUtf8(file.readAll()); +} + + +static void removeRecursive(const QString& dirname) +{ + QDir dir(dirname); + QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); + for (int i = 0; i < entries.count(); ++i) + if (entries[i].isDir()) + removeRecursive(entries[i].filePath()); + else + dir.remove(entries[i].fileName()); + QDir().rmdir(dirname); +} + +void tst_qdeclarativewebview::cleanupTestCase() +{ + removeRecursive(tmpDir()); +} + +void tst_qdeclarativewebview::checkNoErrors(const QDeclarativeComponent& component) +{ + // Wait until the component is ready + QTRY_VERIFY(component.isReady()); + + + if (component.isError()) { + QList<QDeclarativeError> errors = component.errors(); + for (int ii = 0; ii < errors.count(); ++ii) { + const QDeclarativeError &error = errors.at(ii); + QByteArray errorStr = QByteArray::number(error.line()) + ":" + + QByteArray::number(error.column()) + ":" + + error.description().toUtf8(); + qWarning() << errorStr; + } + } + QVERIFY(!component.isError()); +} + +void tst_qdeclarativewebview::basicProperties() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + checkNoErrors(component); + QWebSettings::enablePersistentStorage(tmpDir()); + + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(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); +} + +void tst_qdeclarativewebview::settings() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + checkNoErrors(component); + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QDeclarativeWebSettings *s = wv->settingsObject(); + + // 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); + + 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); + } +} + +void tst_qdeclarativewebview::historyNav() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); + checkNoErrors(component); + QWebSettings::enablePersistentStorage(tmpDir()); + + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(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(); + } + + 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()); +} + +void tst_qdeclarativewebview::multipleWindows() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/newwindows.qml")); + checkNoErrors(component); + + QDeclarativeGrid *grid = qobject_cast<QDeclarativeGrid*>(component.create()); + QVERIFY(grid != 0); + QTRY_COMPARE(grid->children().count(), 2+5); // Component, Loader, 5 WebViews + QDeclarativeItem* popup = qobject_cast<QDeclarativeItem*>(grid->children().at(3)); // first popup after Component, Loaded, original. + QVERIFY(popup != 0); + QTRY_COMPARE(popup->x(), 150.0); +} + +void tst_qdeclarativewebview::loadError() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/loadError.qml")); + checkNoErrors(component); + QWebSettings::enablePersistentStorage(tmpDir()); + + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(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); + + wv->reloadAction()->trigger(); + } +} + +void tst_qdeclarativewebview::setHtml() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml")); + checkNoErrors(component); + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(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>")); + + QSignalSpy spy(wv, SIGNAL(htmlChanged())); + wv->setHtml(QString("<html><head><title>Basic</title></head><body><p>text</p></body></html>")); + QCOMPARE(spy.count(),1); +} + +void tst_qdeclarativewebview::elementAreaAt() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/elements.qml")); + checkNoErrors(component); + QDeclarativeWebView *wv = qobject_cast<QDeclarativeWebView*>(component.create()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + 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()); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->evaluateJavaScript("123").toInt(), 123); + QCOMPARE(wv->evaluateJavaScript("window.status").toString(), QString("status here")); + QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue")); +} + +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); + 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); + wv->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected); // nothing new needed to be painted + wv->setPixelCacheSize(0); // clears the cache + wv->paint(&p,0,0); + QCOMPARE(wv->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->paint(&p,0,0); + QCOMPARE(wv->pixelsPainted(), expected*2); // still there + wv->setPixelCacheSize(expected-1); // too small - will clear the cache + wv->paint(&p,0,0); + QCOMPARE(wv->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"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QDeclarativeItem* oldWindowParent = rootItem->findChild<QDeclarativeItem*>("oldWindowParent"); + QCOMPARE(wv->newWindowParent(), oldWindowParent); + QSignalSpy newWindowParentSpy(wv, SIGNAL(newWindowParentChanged())); + + QDeclarativeItem* newWindowParent = rootItem->findChild<QDeclarativeItem*>("newWindowParent"); + wv->setNewWindowParent(newWindowParent); + QVERIFY(oldWindowParent); + QVERIFY(oldWindowParent->childItems().count() == 0); + QCOMPARE(wv->newWindowParent(), newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(newWindowParent); + QCOMPARE(newWindowParentSpy.count(),1); + + wv->setNewWindowParent(0); + QCOMPARE(newWindowParentSpy.count(),2); +} + +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"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 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); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(&substituteComponent); + QCOMPARE(newWindowComponentSpy.count(),1); + + wv->setNewWindowComponent(0); + QCOMPARE(newWindowComponentSpy.count(),2); +} + +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"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + + QVERIFY(wv->renderingEnabled()); + QSignalSpy renderingEnabledSpy(wv, SIGNAL(renderingEnabledChanged())); + + wv->setRenderingEnabled(false); + QVERIFY(!wv->renderingEnabled()); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(false); + QCOMPARE(renderingEnabledSpy.count(),1); + + wv->setRenderingEnabled(true); + QCOMPARE(renderingEnabledSpy.count(),2); +} + +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"); + QVERIFY(rootItem != 0); + QVERIFY(wv != 0); + QTRY_COMPARE(wv->progress(), 1.0); + QCOMPARE(wv->pressGrabTime(), 200); + QSignalSpy pressGrabTimeSpy(wv, SIGNAL(pressGrabTimeChanged())); + + wv->setPressGrabTime(100); + QCOMPARE(wv->pressGrabTime(), 100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(100); + QCOMPARE(pressGrabTimeSpy.count(),1); + + wv->setPressGrabTime(0); + QCOMPARE(pressGrabTimeSpy.count(),2); +} + +QTEST_MAIN(tst_qdeclarativewebview) + +#include "tst_qdeclarativewebview.moc" diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect index f43e043..f43e043 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/abort.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml index d7b9266..d7b9266 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/abort.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/abort.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort_opened.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml index 72a45e7..72a45e7 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/abort_opened.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_opened.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/abort_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml index aa78cde..aa78cde 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/abort_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/abort_unsent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/attr.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml index 9049fc7..9049fc7 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/attr.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/attr.xml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.xml index 2aa64a3..2aa64a3 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/attr.xml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/attr.xml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/callbackException.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml index 9255922..9255922 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/callbackException.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/callbackException.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/cdata.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml index b2d0209..b2d0209 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/cdata.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/cdata.xml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.xml index 061d37c..061d37c 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/cdata.xml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/cdata.xml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/constructor.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml index 93e44fd..93e44fd 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/constructor.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/constructor.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/defaultState.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml index 4dcf6f9..4dcf6f9 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/defaultState.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/defaultState.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/document.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml index e372361..e372361 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/document.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/document.xml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.xml index fb693ea..fb693ea 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/document.xml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/document.xml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/domExceptionCodes.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml index de5ee4f..de5ee4f 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/domExceptionCodes.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/domExceptionCodes.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/element.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml index 78c0374..78c0374 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/element.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/element.xml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.xml index 071ffae..071ffae 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/element.xml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/element.xml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml index 8d67fad..8d67fad 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml index 37124c7..37124c7 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_args.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml index 505e4b1..505e4b1 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_sent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml index 20fb040..20fb040 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getAllResponseHeaders_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getAllResponseHeaders_unsent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect index a740c79..a740c79 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml index 2f949e1..2f949e1 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.reply index c4b4bb2..c4b4bb2 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml index d5aa4b1..d5aa4b1 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_args.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml index 7538ffd..7538ffd 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_sent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml index 3b55802..3b55802 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/getResponseHeader_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/getResponseHeader_unsent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/instanceStateValues.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml index b8d01c4..b8d01c4 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/instanceStateValues.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/instanceStateValues.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/invalidMethodUsage.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml index b30989b..b30989b 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/invalidMethodUsage.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/invalidMethodUsage.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml index c06bae3..c06bae3 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml index b6d4c32..b6d4c32 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.1.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml index 8c86c20..8c86c20 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_arg_count.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_arg_count.2.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_invalid_method.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml index 69f79ae..69f79ae 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_invalid_method.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_invalid_method.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect index a740c79..a740c79 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.wait b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.wait index e69de29..e69de29 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_network.wait +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_network.wait diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_sync.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml index 1477279..1477279 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_sync.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_sync.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_user.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml index 19e37fa..19e37fa 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_user.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_user.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/open_username.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml index 983ea14..983ea14 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/open_username.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/open_username.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/redirectError.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml index 6b345cc..6b345cc 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/redirectError.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectError.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/redirectRecur.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml index c0321dc..c0321dc 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/redirectRecur.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirectRecur.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/redirects.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml index f6fabdb..f6fabdb 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/redirects.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirects.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/redirecttarget.html b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirecttarget.html index 95f35e0..95f35e0 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/redirecttarget.html +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/redirecttarget.html diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml index 4bb3a7a..4bb3a7a 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/responseText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseText.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/responseXML_invalid.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml index 63f288e..63f288e 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/responseXML_invalid.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/responseXML_invalid.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/seconddocument.html b/tests/auto/declarative/qdeclarativexmlhttprequest/data/seconddocument.html index a33f44b..a33f44b 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/seconddocument.html +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/seconddocument.html diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_alreadySent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml index 0bad7df..0bad7df 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_alreadySent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_alreadySent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect index 81dd4a0..81dd4a0 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml index 03543a9..03543a9 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.1.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.1.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.2.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml index 79a27b6..79a27b6 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.2.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.2.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.3.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml index e048769..e048769 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.3.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.3.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect index 8fcf3ac..8fcf3ac 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml index 7ab0b27..7ab0b27 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.4.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.4.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.5.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml index 29bf2c2..29bf2c2 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.5.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.5.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect index 97e6fac..97e6fac 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml index 135f45c..135f45c 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.6.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.6.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.7.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml index 4a09527..4a09527 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.7.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.7.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_data.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_data.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml index dd5fa46..dd5fa46 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_GET.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect index a740c79..a740c79 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_GET.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_GET.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_PUT.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect index 991bd59..991bd59 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_ignoreData_PUT.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_ignoreData_PUT.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/send_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml index 7f51ecf..7f51ecf 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/send_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/send_unsent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect index 4600f2a..4600f2a 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml index b0723aa..b0723aa 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_args.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml index 8305ae1..8305ae1 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_args.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_args.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_illegalName.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml index bf31eca..bf31eca 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_illegalName.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_illegalName.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_sent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml index c2bbc6e..c2bbc6e 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_sent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_sent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_unsent.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml index 30bc93e..30bc93e 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/setRequestHeader_unsent.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/setRequestHeader_unsent.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/staticStateValues.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml index ec1c5d8..ec1c5d8 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/staticStateValues.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/staticStateValues.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/status.200.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.200.reply index 7ae6951..7ae6951 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/status.200.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.200.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/status.404.reply b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.404.reply index 2e29f56..2e29f56 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/status.404.reply +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.404.reply diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/status.expect b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect index a740c79..a740c79 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/status.expect +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.expect diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/status.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml index 04202c4..04202c4 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/status.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/status.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/statusText.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml index 8becc3b..8becc3b 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/statusText.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/statusText.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/testdocument.html b/tests/auto/declarative/qdeclarativexmlhttprequest/data/testdocument.html index 8fe0f4b..8fe0f4b 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/testdocument.html +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/testdocument.html diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/text.qml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml index 4615a07..4615a07 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/text.qml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.qml diff --git a/tests/auto/declarative/qmlxmlhttprequest/data/text.xml b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.xml index e741688..e741688 100644 --- a/tests/auto/declarative/qmlxmlhttprequest/data/text.xml +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/data/text.xml diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro new file mode 100644 index 0000000..7bc92af --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/qdeclarativexmlhttprequest.pro @@ -0,0 +1,13 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative network +macx:CONFIG -= app_bundle + +INCLUDEPATH += ../shared/ +HEADERS += ../shared/testhttpserver.h + +SOURCES += tst_qdeclarativexmlhttprequest.cpp \ + ../shared/testhttpserver.cpp + + +# Define SRCDIR equal to test's source directory +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp new file mode 100644 index 0000000..37d48fa --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmlhttprequest/tst_qdeclarativexmlhttprequest.cpp @@ -0,0 +1,1315 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDebug> +#include <QNetworkCookieJar> +#include "testhttpserver.h" + +#define SERVER_PORT 14445 + +class tst_qdeclarativexmlhttprequest : public QObject +{ + Q_OBJECT +public: + tst_qdeclarativexmlhttprequest() {} + +private slots: + void initTestCase() { + if (QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')) != QLatin1String("en-US")) { + qWarning() << "Test will fail unless LANG is en_US"; + } + } + + void domExceptionCodes(); + void callbackException(); + void callbackException_data(); + void staticStateValues(); + void instanceStateValues(); + void constructor(); + void defaultState(); + void open(); + void open_invalid_method(); + void open_sync(); + void open_arg_count(); + void setRequestHeader(); + void setRequestHeader_unsent(); + void setRequestHeader_illegalName_data(); + void setRequestHeader_illegalName(); + void setRequestHeader_sent(); + void setRequestHeader_args(); + void send_unsent(); + void send_alreadySent(); + void send_ignoreData(); + void send_withdata(); + void abort(); + void abort_unsent(); + void abort_opened(); + void getResponseHeader(); + void getResponseHeader_unsent(); + void getResponseHeader_sent(); + void getResponseHeader_args(); + void getAllResponseHeaders(); + void getAllResponseHeaders_unsent(); + void getAllResponseHeaders_sent(); + void getAllResponseHeaders_args(); + void status(); + void statusText(); + void responseText(); + void responseXML_invalid(); + void invalidMethodUsage(); + void redirects(); + + // Attributes + void document(); + void element(); + void attr(); + void text(); + void cdata(); + + // Crashes + // void outstanding_request_at_shutdown(); + + // void network_errors() + // void readyState() + +private: + QDeclarativeEngine engine; +}; + +inline QUrl TEST_FILE(const QString &filename) +{ + return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); +} + +// Test that the dom exception codes are correct +void tst_qdeclarativexmlhttprequest::domExceptionCodes() +{ + QDeclarativeComponent component(&engine, TEST_FILE("domExceptionCodes.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("index_size_err").toInt(), 1); + QCOMPARE(object->property("domstring_size_err").toInt(), 2); + QCOMPARE(object->property("hierarchy_request_err").toInt(), 3); + QCOMPARE(object->property("wrong_document_err").toInt(), 4); + QCOMPARE(object->property("invalid_character_err").toInt(), 5); + QCOMPARE(object->property("no_data_allowed_err").toInt(), 6); + QCOMPARE(object->property("no_modification_allowed_err").toInt(), 7); + QCOMPARE(object->property("not_found_err").toInt(), 8); + QCOMPARE(object->property("not_supported_err").toInt(), 9); + QCOMPARE(object->property("inuse_attribute_err").toInt(), 10); + QCOMPARE(object->property("invalid_state_err").toInt(), 11); + QCOMPARE(object->property("syntax_err").toInt(), 12); + QCOMPARE(object->property("invalid_modification_err").toInt(), 13); + QCOMPARE(object->property("namespace_err").toInt(), 14); + QCOMPARE(object->property("invalid_access_err").toInt(), 15); + QCOMPARE(object->property("validation_err").toInt(), 16); + QCOMPARE(object->property("type_mismatch_err").toInt(), 17); + + delete object; +} + +#define TRY_WAIT(expr) \ + do { \ + for (int ii = 0; ii < 6; ++ii) { \ + if ((expr)) break; \ + QTest::qWait(50); \ + } \ + QVERIFY((expr)); \ + } while (false) + + +void tst_qdeclarativexmlhttprequest::callbackException_data() +{ + QTest::addColumn<QString>("which"); + QTest::addColumn<int>("line"); + + QTest::newRow("on-opened") << "1" << 15; + QTest::newRow("on-loading") << "3" << 15; + QTest::newRow("on-done") << "4" << 15; +} + +void tst_qdeclarativexmlhttprequest::callbackException() +{ + // Test exception reporting for exceptions thrown at various points. + + QFETCH(QString, which); + QFETCH(int, line); + + QString expect = TEST_FILE("callbackException.qml").toString() + ":"+QString::number(line)+": Error: Exception from Callback"; + QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); + + QDeclarativeComponent component(&engine, TEST_FILE("callbackException.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "testdocument.html"); + object->setProperty("which", which); + component.completeCreate(); + + TRY_WAIT(object->property("threw").toBool() == true); + + delete object; +} + +// Test that the state value properties on the XMLHttpRequest constructor have the correct values. +// ### WebKit does not do this, but it seems to fit the standard and QML better +void tst_qdeclarativexmlhttprequest::staticStateValues() +{ + QDeclarativeComponent component(&engine, TEST_FILE("staticStateValues.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("unsent").toInt(), 0); + QCOMPARE(object->property("opened").toInt(), 1); + QCOMPARE(object->property("headers_received").toInt(), 2); + QCOMPARE(object->property("loading").toInt(), 3); + QCOMPARE(object->property("done").toInt(), 4); + + delete object; +} + +// Test that the state value properties on instances have the correct values. +void tst_qdeclarativexmlhttprequest::instanceStateValues() +{ + QDeclarativeComponent component(&engine, TEST_FILE("instanceStateValues.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("unsent").toInt(), 0); + QCOMPARE(object->property("opened").toInt(), 1); + QCOMPARE(object->property("headers_received").toInt(), 2); + QCOMPARE(object->property("loading").toInt(), 3); + QCOMPARE(object->property("done").toInt(), 4); + + delete object; +} + +// Test calling constructor +void tst_qdeclarativexmlhttprequest::constructor() +{ + QDeclarativeComponent component(&engine, TEST_FILE("constructor.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("calledAsConstructor").toBool(), true); + QCOMPARE(object->property("calledAsFunction").toBool(), true); + + delete object; +} + +// Test that all the properties are set correctly before any request is sent +void tst_qdeclarativexmlhttprequest::defaultState() +{ + QDeclarativeComponent component(&engine, TEST_FILE("defaultState.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("readState").toInt(), 0); + QCOMPARE(object->property("statusIsException").toBool(), true); + QCOMPARE(object->property("statusTextIsException").toBool(), true); + QCOMPARE(object->property("responseText").toString(), QString()); + QCOMPARE(object->property("responseXMLIsNull").toBool(), true); + + delete object; +} + +// Test valid XMLHttpRequest.open() calls +void tst_qdeclarativexmlhttprequest::open() +{ + // Relative url + { + QDeclarativeComponent component(&engine, TEST_FILE("open.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Absolute url + { + QDeclarativeComponent component(&engine, TEST_FILE("open.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", TEST_FILE("testdocument.html").toString()); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Absolute network url + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("open_network.expect"), + TEST_FILE("open_network.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("open.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // User/pass + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("open_network.expect"), + TEST_FILE("open_network.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("open_user.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + // ### Check that the username/password were sent to the server + + delete object; + } +} + +// Test that calling XMLHttpRequest.open() with an invalid method raises an exception +void tst_qdeclarativexmlhttprequest::open_invalid_method() +{ + QDeclarativeComponent component(&engine, TEST_FILE("open_invalid_method.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("exceptionThrown").toBool(), true); + + delete object; +} + +// Test that calling XMLHttpRequest.open() with sync raises an exception +void tst_qdeclarativexmlhttprequest::open_sync() +{ + QDeclarativeComponent component(&engine, TEST_FILE("open_sync.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("exceptionThrown").toBool(), true); + + delete object; +} + +// Calling with incorrect arg count raises an exception +void tst_qdeclarativexmlhttprequest::open_arg_count() +{ + { + QDeclarativeComponent component(&engine, TEST_FILE("open_arg_count.1.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("exceptionThrown").toBool(), true); + + delete object; + } + + { + QDeclarativeComponent component(&engine, TEST_FILE("open_arg_count.2.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("exceptionThrown").toBool(), true); + + delete object; + } +} + +// Test valid setRequestHeader() calls +void tst_qdeclarativexmlhttprequest::setRequestHeader() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("setRequestHeader.expect"), + TEST_FILE("setRequestHeader.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Test setting headers before open() throws exception +void tst_qdeclarativexmlhttprequest::setRequestHeader_unsent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_unsent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +void tst_qdeclarativexmlhttprequest::setRequestHeader_illegalName_data() +{ + QTest::addColumn<QString>("name"); + + QTest::newRow("Accept-Charset") << "AccePT-CHArset"; + QTest::newRow("Accept-Encoding") << "AccEpt-EnCOding"; + QTest::newRow("Connection") << "ConnECtion"; + QTest::newRow("Content-Length") << "ContEnt-LenGth"; + QTest::newRow("Cookie") << "CookIe"; + QTest::newRow("Cookie2") << "CoOkie2"; + QTest::newRow("Content-Transfer-Encoding") << "ConteNT-tRANSFER-eNCOding"; + QTest::newRow("Date") << "DaTE"; + QTest::newRow("Expect") << "ExPect"; + QTest::newRow("Host") << "HoST"; + QTest::newRow("Keep-Alive") << "KEEP-aLive"; + QTest::newRow("Referer") << "ReferEr"; + QTest::newRow("TE") << "Te"; + QTest::newRow("Trailer") << "TraILEr"; + QTest::newRow("Transfer-Encoding") << "tRANsfer-Encoding"; + QTest::newRow("Upgrade") << "UpgrADe"; + QTest::newRow("User-Agent") << "uSEr-Agent"; + QTest::newRow("Via") << "vIa"; + QTest::newRow("Proxy-") << "ProXy-"; + QTest::newRow("Sec-") << "SeC-"; + QTest::newRow("Proxy-*") << "Proxy-BLAH"; + QTest::newRow("Sec-*") << "Sec-F"; +} + +// Tests that using illegal header names has no effect +void tst_qdeclarativexmlhttprequest::setRequestHeader_illegalName() +{ + QFETCH(QString, name); + + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("open_network.expect"), + TEST_FILE("open_network.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_illegalName.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("header", name); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Test that attempting to set a header after a request is sent throws an exception +void tst_qdeclarativexmlhttprequest::setRequestHeader_sent() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("open_network.expect"), + TEST_FILE("open_network.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_sent.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("test").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Invalid arg count throws exception +void tst_qdeclarativexmlhttprequest::setRequestHeader_args() +{ + QDeclarativeComponent component(&engine, TEST_FILE("setRequestHeader_args.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("exceptionThrown").toBool(), true); + + delete object; +} + +// Test that calling send() in UNSENT state throws an exception +void tst_qdeclarativexmlhttprequest::send_unsent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("send_unsent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +// Test attempting to resend a sent request throws an exception +void tst_qdeclarativexmlhttprequest::send_alreadySent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("send_alreadySent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Test that send for a GET or HEAD ignores data +void tst_qdeclarativexmlhttprequest::send_ignoreData() +{ + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_ignoreData_GET.expect"), + TEST_FILE("send_ignoreData.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("reqType", "GET"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_ignoreData_PUT.expect"), + TEST_FILE("send_ignoreData.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_ignoreData.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("reqType", "HEAD"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } +} + +// Test that send()'ing data works +void tst_qdeclarativexmlhttprequest::send_withdata() +{ + // No content-type + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.1.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Correct content-type + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.2.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Incorrect content-type + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.3.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Correct content-type - out of order + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.4.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.4.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Incorrect content-type - out of order + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.4.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.5.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // PUT + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.6.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.6.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } + + // Correct content-type - no charset + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), + TEST_FILE("send_data.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("send_data.7.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; + } +} + +// Test abort() has no effect in unsent state +void tst_qdeclarativexmlhttprequest::abort_unsent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("abort_unsent.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Test abort() cancels an open (but unsent) request +void tst_qdeclarativexmlhttprequest::abort_opened() +{ + QDeclarativeComponent component(&engine, TEST_FILE("abort_opened.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +// Test abort() aborts in progress send +void tst_qdeclarativexmlhttprequest::abort() +{ + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("abort.expect"), + TEST_FILE("abort.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("abort.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html"); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("seenDone").toBool(), true); + QCOMPARE(object->property("didNotSeeUnsent").toBool(), true); + QCOMPARE(object->property("endStateUnsent").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + delete object; +} + +void tst_qdeclarativexmlhttprequest::getResponseHeader() +{ + QDeclarativeEngine engine; // Avoid cookie contamination + + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"), + TEST_FILE("getResponseHeader.reply"), + TEST_FILE("testdocument.html"))); + + + QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("headersReceivedState").toBool(), true); + QCOMPARE(object->property("headersReceivedNullHeader").toBool(), true); + QCOMPARE(object->property("headersReceivedValidHeader").toBool(), true); + QCOMPARE(object->property("headersReceivedMultiValidHeader").toBool(), true); + QCOMPARE(object->property("headersReceivedCookieHeader").toBool(), true); + + QCOMPARE(object->property("doneState").toBool(), true); + QCOMPARE(object->property("doneNullHeader").toBool(), true); + QCOMPARE(object->property("doneValidHeader").toBool(), true); + QCOMPARE(object->property("doneMultiValidHeader").toBool(), true); + QCOMPARE(object->property("doneCookieHeader").toBool(), true); + + delete object; +} + +// Test getResponseHeader throws an exception in an invalid state +void tst_qdeclarativexmlhttprequest::getResponseHeader_unsent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_unsent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +// Test getResponseHeader throws an exception in an invalid state +void tst_qdeclarativexmlhttprequest::getResponseHeader_sent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_sent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +// Invalid arg count throws exception +void tst_qdeclarativexmlhttprequest::getResponseHeader_args() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getResponseHeader_args.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("exceptionThrown").toBool() == true); + + delete object; +} + +void tst_qdeclarativexmlhttprequest::getAllResponseHeaders() +{ + QDeclarativeEngine engine; // Avoid cookie contamination + + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"), + TEST_FILE("getResponseHeader.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + component.completeCreate(); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("openedState").toBool(), true); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("headersReceivedState").toBool(), true); + QCOMPARE(object->property("headersReceivedHeader").toBool(), true); + + QCOMPARE(object->property("doneState").toBool(), true); + QCOMPARE(object->property("doneHeader").toBool(), true); + + delete object; +} + +// Test getAllResponseHeaders throws an exception in an invalid state +void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_unsent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_unsent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +// Test getAllResponseHeaders throws an exception in an invalid state +void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_sent() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_sent.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("test").toBool(), true); + + delete object; +} + +// Invalid arg count throws exception +void tst_qdeclarativexmlhttprequest::getAllResponseHeaders_args() +{ + QDeclarativeComponent component(&engine, TEST_FILE("getAllResponseHeaders_args.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("exceptionThrown").toBool() == true); + + delete object; +} + +void tst_qdeclarativexmlhttprequest::status() +{ + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.200.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("status.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedStatus", 200); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("sentException").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("resetException").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.404.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("status.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedStatus", 404); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("sentException").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("resetException").toBool(), true); + + delete object; + } +} + +void tst_qdeclarativexmlhttprequest::statusText() +{ + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.200.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("statusText.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedStatus", "OK"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("sentException").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("resetException").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.404.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("statusText.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedStatus", "Document not found"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsentException").toBool(), true); + QCOMPARE(object->property("openedException").toBool(), true); + QCOMPARE(object->property("sentException").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("resetException").toBool(), true); + + delete object; + } +} + +void tst_qdeclarativexmlhttprequest::responseText() +{ + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.200.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("responseText.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedText", "QML Rocks!\n"); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsent").toBool(), true); + QCOMPARE(object->property("opened").toBool(), true); + QCOMPARE(object->property("sent").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("reset").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.200.reply"), + QUrl())); + + QDeclarativeComponent component(&engine, TEST_FILE("responseText.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedText", ""); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsent").toBool(), true); + QCOMPARE(object->property("opened").toBool(), true); + QCOMPARE(object->property("sent").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("reset").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + QVERIFY(server.wait(TEST_FILE("status.expect"), + TEST_FILE("status.404.reply"), + TEST_FILE("testdocument.html"))); + + QDeclarativeComponent component(&engine, TEST_FILE("responseText.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); + object->setProperty("expectedText", ""); + component.completeCreate(); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("unsent").toBool(), true); + QCOMPARE(object->property("opened").toBool(), true); + QCOMPARE(object->property("sent").toBool(), true); + QCOMPARE(object->property("headersReceived").toBool(), true); + QCOMPARE(object->property("loading").toBool(), true); + QCOMPARE(object->property("done").toBool(), true); + QCOMPARE(object->property("reset").toBool(), true); + + delete object; + } +} + +// Test that calling hte XMLHttpRequest methods on a non-XMLHttpRequest object +// throws an exception +void tst_qdeclarativexmlhttprequest::invalidMethodUsage() +{ + QDeclarativeComponent component(&engine, TEST_FILE("invalidMethodUsage.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + QCOMPARE(object->property("onreadystatechange").toBool(), true); + QCOMPARE(object->property("readyState").toBool(), true); + QCOMPARE(object->property("status").toBool(), true); + QCOMPARE(object->property("statusText").toBool(), true); + QCOMPARE(object->property("responseText").toBool(), true); + QCOMPARE(object->property("responseXML").toBool(), true); + + QCOMPARE(object->property("open").toBool(), true); + QCOMPARE(object->property("setRequestHeader").toBool(), true); + QCOMPARE(object->property("send").toBool(), true); + QCOMPARE(object->property("abort").toBool(), true); + QCOMPARE(object->property("getResponseHeader").toBool(), true); + QCOMPARE(object->property("getAllResponseHeaders").toBool(), true); + + delete object; +} + +// Test that XMLHttpRequest transparently redirects +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"); + + QDeclarativeComponent component(&engine, TEST_FILE("redirects.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); + object->setProperty("expectedText", ""); + component.completeCreate(); + + TRY_WAIT(object->property("done").toBool() == true); + QCOMPARE(object->property("dataOK").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html"); + server.serveDirectory("data"); + + QDeclarativeComponent component(&engine, TEST_FILE("redirectError.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); + object->setProperty("expectedText", ""); + component.completeCreate(); + + TRY_WAIT(object->property("done").toBool() == true); + QCOMPARE(object->property("dataOK").toBool(), true); + + delete object; + } + + { + TestHTTPServer server(SERVER_PORT); + QVERIFY(server.isValid()); + server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html"); + server.serveDirectory("data"); + + QDeclarativeComponent component(&engine, TEST_FILE("redirectRecur.qml")); + QObject *object = component.beginCreate(engine.rootContext()); + QVERIFY(object != 0); + object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); + object->setProperty("expectedText", ""); + component.completeCreate(); + + for (int ii = 0; ii < 60; ++ii) { + if (object->property("done").toBool()) break; + QTest::qWait(50); + } + QVERIFY(object->property("done").toBool() == true); + + QCOMPARE(object->property("dataOK").toBool(), true); + + delete object; + } +} + +void tst_qdeclarativexmlhttprequest::responseXML_invalid() +{ + QDeclarativeComponent component(&engine, TEST_FILE("responseXML_invalid.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlNull").toBool(), true); + + delete object; +} + +// Test the Document DOM element +void tst_qdeclarativexmlhttprequest::document() +{ + QDeclarativeComponent component(&engine, TEST_FILE("document.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlTest").toBool(), true); + + delete object; +} + +// Test the Element DOM element +void tst_qdeclarativexmlhttprequest::element() +{ + QDeclarativeComponent component(&engine, TEST_FILE("element.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlTest").toBool(), true); + + delete object; +} + +// Test the Attr DOM element +void tst_qdeclarativexmlhttprequest::attr() +{ + QDeclarativeComponent component(&engine, TEST_FILE("attr.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlTest").toBool(), true); + + delete object; +} + +// Test the Text DOM element +void tst_qdeclarativexmlhttprequest::text() +{ + QDeclarativeComponent component(&engine, TEST_FILE("text.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlTest").toBool(), true); + + delete object; +} + +// Test the CDataSection DOM element +void tst_qdeclarativexmlhttprequest::cdata() +{ + QDeclarativeComponent component(&engine, TEST_FILE("cdata.qml")); + QObject *object = component.create(); + QVERIFY(object != 0); + + TRY_WAIT(object->property("dataOK").toBool() == true); + + QCOMPARE(object->property("xmlTest").toBool(), true); + + delete object; +} + +QTEST_MAIN(tst_qdeclarativexmlhttprequest) + +#include "tst_qdeclarativexmlhttprequest.moc" diff --git a/tests/auto/declarative/qmlxmllistmodel/data/model.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml index 2cbb027..2cbb027 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/model.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.qml diff --git a/tests/auto/declarative/qmlxmllistmodel/data/model.xml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.xml index 40cd6d0..40cd6d0 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/model.xml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/model.xml diff --git a/tests/auto/declarative/qmlxmllistmodel/data/model2.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml index 140e0ad..140e0ad 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/model2.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/model2.qml diff --git a/tests/auto/declarative/qmlxmllistmodel/data/recipes.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml index 13dea91..13dea91 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/recipes.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.qml diff --git a/tests/auto/declarative/qmlxmllistmodel/data/recipes.xml b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.xml index d71de60..d71de60 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/recipes.xml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/recipes.xml diff --git a/tests/auto/declarative/qmlxmllistmodel/data/roleErrors.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml index 26c533f..26c533f 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/roleErrors.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleErrors.qml diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml new file mode 100644 index 0000000..b90e57e --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/roleKeys.qml @@ -0,0 +1,13 @@ +import Qt 4.6 + +XmlListModel { + query: "/data/item" + XmlRole { id: nameRole; name: "name"; query: "name/string()"; isKey: true } + XmlRole { name: "age"; query: "age/number()"; isKey: true } + XmlRole { name: "sport"; query: "sport/string()" } + + function disableNameKey() { + nameRole.isKey = false; + } +} + diff --git a/tests/auto/declarative/qmlxmllistmodel/data/unique.qml b/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml index ed0f293..ed0f293 100644 --- a/tests/auto/declarative/qmlxmllistmodel/data/unique.qml +++ b/tests/auto/declarative/qdeclarativexmllistmodel/data/unique.qml diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro new file mode 100644 index 0000000..88832dc --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmllistmodel/qdeclarativexmllistmodel.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +contains(QT_CONFIG,declarative): QT += declarative gui +contains(QT_CONFIG,xmlpatterns) { + QT += xmlpatterns + DEFINES += QTEST_XMLPATTERNS +} +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativexmllistmodel.cpp + +DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp new file mode 100644 index 0000000..e19e03d --- /dev/null +++ b/tests/auto/declarative/qdeclarativexmllistmodel/tst_qdeclarativexmllistmodel.cpp @@ -0,0 +1,457 @@ +/**************************************************************************** +** +** 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 <QtTest/qsignalspy.h> +#include <QtCore/qtimer.h> + +#ifdef QTEST_XMLPATTERNS +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativexmllistmodel_p.h> +#include "../../../shared/util.h" + +typedef QPair<int, int> QDeclarativeXmlListRange; +typedef QList<QVariantList> QDeclarativeXmlModelData; + +Q_DECLARE_METATYPE(QList<QDeclarativeXmlListRange>) +Q_DECLARE_METATYPE(QDeclarativeXmlModelData) + +class tst_qdeclarativexmllistmodel : public QObject + +{ + Q_OBJECT +public: + tst_qdeclarativexmllistmodel() {} + +private slots: + void buildModel(); + void missingFields(); + void cdata(); + void attributes(); + void roles(); + void roleErrors(); + void uniqueRoleNames(); + void useKeys(); + void useKeys_data(); + void noKeysValueChanges(); + void keysChanged(); + +private: + QString makeItemXmlAndData(const QString &data, QDeclarativeXmlModelData *modelData = 0) const + { + if (modelData) + modelData->clear(); + QString xml; + + if (!data.isEmpty()) { + QStringList items = data.split(";"); + foreach(const QString &item, items) { + QVariantList variants; + xml += QLatin1String("<item>"); + QStringList fields = item.split(","); + foreach(const QString &field, fields) { + QStringList values = field.split("="); + Q_ASSERT(values.count() == 2); + xml += QString("<%1>%2</%1>").arg(values[0], values[1]); + if (!modelData) + continue; + bool isNum = false; + int number = values[1].toInt(&isNum); + if (isNum) + variants << number; + else + variants << values[1]; + } + xml += QLatin1String("</item>"); + if (modelData) + modelData->append(variants); + } + } + + QString decl = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>"; + return decl + QLatin1String("<data>") + xml + QLatin1String("</data>"); + } + + QDeclarativeEngine engine; +}; + +void tst_qdeclarativexmllistmodel::buildModel() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles; + roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; + QHash<int, QVariant> data = listModel->data(3, roles); + QVERIFY(data.count() == 4); + QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Spot")); + QCOMPARE(data.value(Qt::UserRole+1).toString(), QLatin1String("Dog")); + QCOMPARE(data.value(Qt::UserRole+2).toInt(), 9); + QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("Medium")); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::missingFields() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model2.qml")); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles; + roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3 << Qt::UserRole + 4; + QHash<int, QVariant> data = listModel->data(5, roles); + QVERIFY(data.count() == 5); + QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("")); + QCOMPARE(data.value(Qt::UserRole+4).toString(), QLatin1String("")); + + data = listModel->data(7, roles); + QVERIFY(data.count() == 5); + QCOMPARE(data.value(Qt::UserRole+2).toString(), QLatin1String("")); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::cdata() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 5); + + QList<int> roles; + roles << Qt::UserRole + 2; + QHash<int, QVariant> data = listModel->data(2, roles); + QVERIFY(data.count() == 1); + QVERIFY(data.value(Qt::UserRole+2).toString().startsWith(QLatin1String("<html>"))); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::attributes() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 5); + + QList<int> roles; + roles << Qt::UserRole; + QHash<int, QVariant> data = listModel->data(2, roles); + QVERIFY(data.count() == 1); + QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Vegetable Soup")); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::roles() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles = listModel->roles(); + QCOMPARE(roles.count(), 4); + QCOMPARE(listModel->toString(roles.at(0)), QLatin1String("name")); + QCOMPARE(listModel->toString(roles.at(1)), QLatin1String("type")); + QCOMPARE(listModel->toString(roles.at(2)), QLatin1String("age")); + QCOMPARE(listModel->toString(roles.at(3)), QLatin1String("size")); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::roleErrors() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml")); + QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5) An XmlRole query must not start with '/'").toUtf8().constData()); + //### make sure we receive all expected warning messages. + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles; + roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; + QHash<int, QVariant> data = listModel->data(3, roles); + QVERIFY(data.count() == 4); + + //### should any of these return valid values? + QCOMPARE(data.value(Qt::UserRole), QVariant()); + QCOMPARE(data.value(Qt::UserRole+1), QVariant()); + QCOMPARE(data.value(Qt::UserRole+2), QVariant()); + + QEXPECT_FAIL("", "QT-2456", Continue); + QCOMPARE(data.value(Qt::UserRole+3), QVariant()); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::uniqueRoleNames() +{ + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml")); + QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5) \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); + QDeclarativeXmlListModel *listModel = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(listModel != 0); + QTRY_COMPARE(listModel->count(), 9); + + QList<int> roles = listModel->roles(); + QCOMPARE(roles.count(), 1); + + delete listModel; +} + +void tst_qdeclarativexmllistmodel::useKeys() +{ + // If using incremental updates through keys, the model should only + // insert & remove some of the items, instead of throwing everything + // away and causing the view to repaint the whole view. + + QFETCH(QString, oldXml); + QFETCH(int, oldCount); + QFETCH(QString, newXml); + QFETCH(QDeclarativeXmlModelData, newData); + QFETCH(QList<QDeclarativeXmlListRange>, insertRanges); + QFETCH(QList<QDeclarativeXmlListRange>, removeRanges); + + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(model != 0); + + model->setXml(oldXml); + QTRY_COMPARE(model->count(), oldCount); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + model->setXml(newXml); + + if (oldCount != newData.count()) { + QTRY_COMPARE(model->count(), newData.count()); + QCOMPARE(spyCount.count(), 1); + } else { + QTRY_VERIFY(spyInsert.count() > 0 || spyRemove.count() > 0); + QCOMPARE(spyCount.count(), 0); + } + + QList<int> roles = model->roles(); + for (int i=0; i<model->count(); i++) { + for (int j=0; j<roles.count(); j++) + QCOMPARE(model->data(i, roles[j]), newData[i][j]); + } + + QCOMPARE(spyInsert.count(), insertRanges.count()); + for (int i=0; i<spyInsert.count(); i++) { + QCOMPARE(spyInsert[i][0].toInt(), insertRanges[i].first); + QCOMPARE(spyInsert[i][1].toInt(), insertRanges[i].second); + } + + QCOMPARE(spyRemove.count(), removeRanges.count()); + for (int i=0; i<spyRemove.count(); i++) { + QCOMPARE(spyRemove[i][0].toInt(), removeRanges[i].first); + QCOMPARE(spyRemove[i][1].toInt(), removeRanges[i].second); + } +} + +void tst_qdeclarativexmllistmodel::useKeys_data() +{ + QTest::addColumn<QString>("oldXml"); + QTest::addColumn<int>("oldCount"); + QTest::addColumn<QString>("newXml"); + QTest::addColumn<QDeclarativeXmlModelData>("newData"); + QTest::addColumn<QList<QDeclarativeXmlListRange> >("insertRanges"); + QTest::addColumn<QList<QDeclarativeXmlListRange> >("removeRanges"); + + QDeclarativeXmlModelData modelData; + + QTest::newRow("append 1") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1)) + << QList<QDeclarativeXmlListRange>(); + + QTest::newRow("append multiple") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 2)) + << QList<QDeclarativeXmlListRange>(); + + QTest::newRow("insert in different spots") + << makeItemXmlAndData("name=B,age=35,sport=Athletics") << 1 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2)) + << QList<QDeclarativeXmlListRange>(); + + QTest::newRow("insert in middle") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=D,age=55,sport=Golf") << 2 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 2)) + << QList<QDeclarativeXmlListRange>(); + + QTest::newRow("remove first") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2 + << makeItemXmlAndData("name=B,age=35,sport=Athletics", &modelData) + << modelData + << QList<QDeclarativeXmlListRange>() + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1)); + + QTest::newRow("remove last") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics") << 2 + << makeItemXmlAndData("name=A,age=25,sport=Football", &modelData) + << modelData + << QList<QDeclarativeXmlListRange>() + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1)); + + QTest::newRow("remove from multiple spots") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf;name=E,age=65,sport=Fencing") << 5 + << makeItemXmlAndData("name=A,age=25,sport=Football;name=C,age=45,sport=Curling", &modelData) + << modelData + << QList<QDeclarativeXmlListRange>() + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1) << qMakePair(3,2)); + + QTest::newRow("remove all") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling") << 3 + << makeItemXmlAndData("", &modelData) + << modelData + << QList<QDeclarativeXmlListRange>() + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 3)); + + QTest::newRow("replace item") + << makeItemXmlAndData("name=A,age=25,sport=Football") << 1 + << makeItemXmlAndData("name=ZZZ,age=25,sport=Football", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1)) + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1)); + + QTest::newRow("add and remove simultaneously") + << makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics;name=C,age=45,sport=Curling;name=D,age=55,sport=Golf") << 4 + << makeItemXmlAndData("name=B,age=35,sport=Athletics;name=E,age=65,sport=Fencing", &modelData) + << modelData + << (QList<QDeclarativeXmlListRange>() << qMakePair(1, 1)) + << (QList<QDeclarativeXmlListRange>() << qMakePair(0, 1) << qMakePair(2,2)); +} + +void tst_qdeclarativexmllistmodel::noKeysValueChanges() +{ + // The 'key' roles are 'name' and 'age', as defined in roleKeys.qml. + // If a 'sport' value is changed, the model should not be reloaded, + // since 'sport' is not marked as a key. + + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(model != 0); + + QString xml; + + xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics"); + model->setXml(xml); + QTRY_COMPARE(model->count(), 2); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + xml = makeItemXmlAndData("name=A,age=25,sport=AussieRules;name=B,age=35,sport=Athletics"); + model->setXml(xml); + + // wait for the new xml data to be set, and verify no signals were emitted + for (int i=0; i<50; i++) { + QTest::qWait(100); + if (model->data(0, model->roles()[2]).toString() != QLatin1String("AussieRules")) + break; + } + QCOMPARE(model->data(0, model->roles()[2]).toString(), QLatin1String("AussieRules")); + + QVERIFY(spyInsert.count() == 0); + QVERIFY(spyRemove.count() == 0); + QVERIFY(spyCount.count() == 0); + + QCOMPARE(model->count(), 2); +} + +void tst_qdeclarativexmllistmodel::keysChanged() +{ + // If the key roles change, the next time the data is reloaded, it should + // delete all its data and build a clean model (i.e. same behaviour as + // if no keys are set). + + QDeclarativeComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleKeys.qml")); + QDeclarativeXmlListModel *model = qobject_cast<QDeclarativeXmlListModel*>(component.create()); + QVERIFY(model != 0); + + QString xml = makeItemXmlAndData("name=A,age=25,sport=Football;name=B,age=35,sport=Athletics"); + model->setXml(xml); + QTRY_COMPARE(model->count(), 2); + + QSignalSpy spyInsert(model, SIGNAL(itemsInserted(int,int))); + QSignalSpy spyRemove(model, SIGNAL(itemsRemoved(int,int))); + QSignalSpy spyCount(model, SIGNAL(countChanged())); + + QVERIFY(QMetaObject::invokeMethod(model, "disableNameKey")); + model->setXml(xml); + + QTRY_VERIFY(spyInsert.count() > 0 && spyRemove.count() > 0); + + QCOMPARE(spyInsert.count(), 1); + QCOMPARE(spyInsert[0][0].toInt(), 0); + QCOMPARE(spyInsert[0][1].toInt(), 2); + + QCOMPARE(spyRemove.count(), 1); + QCOMPARE(spyRemove[0][0].toInt(), 0); + QCOMPARE(spyRemove[0][1].toInt(), 2); + + QCOMPARE(spyCount.count(), 0); +} + +QTEST_MAIN(tst_qdeclarativexmllistmodel) + +#include "tst_qdeclarativexmllistmodel.moc" + +#else +QTEST_NOOP_MAIN +#endif diff --git a/tests/auto/declarative/qmlanimations/qmlanimations.pro b/tests/auto/declarative/qmlanimations/qmlanimations.pro deleted file mode 100644 index 447fb0f..0000000 --- a/tests/auto/declarative/qmlanimations/qmlanimations.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlanimations.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp b/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp deleted file mode 100644 index 9eae308..0000000 --- a/tests/auto/declarative/qmlanimations/tst_qmlanimations.cpp +++ /dev/null @@ -1,672 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <private/qmlanimation_p.h> -#include <QVariantAnimation> - -class tst_qmlanimations : public QObject -{ - Q_OBJECT -public: - tst_qmlanimations() {} - -private slots: - void initTestCase() { QmlEngine engine; } // ensure types are registered - - void simpleProperty(); - void simpleNumber(); - void simpleColor(); - void alwaysRunToEnd(); - void complete(); - void resume(); - void dotProperty(); - void badTypes(); - void badProperties(); - void mixedTypes(); - void properties(); - void propertiesTransition(); - void easingStringConversion(); - void invalidDuration(); - void attached(); - void propertyValueSourceDefaultStart(); - void dontStart(); -}; - -#define QTIMED_COMPARE(lhs, rhs) do { \ - for (int ii = 0; ii < 5; ++ii) { \ - if (lhs == rhs) \ - break; \ - QTest::qWait(50); \ - } \ - QCOMPARE(lhs, rhs); \ -} while (false) - -void tst_qmlanimations::simpleProperty() -{ - QmlGraphicsRectangle rect; - QmlPropertyAnimation animation; - animation.setTarget(&rect); - animation.setProperty("pos"); - animation.setTo(QPointF(200,200)); - QVERIFY(animation.target() == &rect); - QVERIFY(animation.property() == "pos"); - QVERIFY(animation.to().toPointF() == QPointF(200,200)); - animation.start(); - QVERIFY(animation.isRunning()); - QTest::qWait(animation.duration()); - QTIMED_COMPARE(rect.pos(), QPointF(200,200)); - - rect.setPos(0,0); - animation.start(); - animation.pause(); - QVERIFY(animation.isRunning()); - QVERIFY(animation.isPaused()); - animation.setCurrentTime(125); - QVERIFY(animation.currentTime() == 125); - QCOMPARE(rect.pos(), QPointF(100,100)); -} - -void tst_qmlanimations::simpleNumber() -{ - QmlGraphicsRectangle rect; - QmlNumberAnimation animation; - animation.setTarget(&rect); - animation.setProperty("x"); - animation.setTo(200); - QVERIFY(animation.target() == &rect); - QVERIFY(animation.property() == "x"); - QVERIFY(animation.to() == 200); - animation.start(); - QVERIFY(animation.isRunning()); - QTest::qWait(animation.duration()); - QTIMED_COMPARE(rect.x(), qreal(200)); - - rect.setX(0); - animation.start(); - animation.pause(); - QVERIFY(animation.isRunning()); - QVERIFY(animation.isPaused()); - animation.setCurrentTime(125); - QVERIFY(animation.currentTime() == 125); - QCOMPARE(rect.x(), qreal(100)); -} - -void tst_qmlanimations::simpleColor() -{ - QmlGraphicsRectangle rect; - QmlColorAnimation animation; - animation.setTarget(&rect); - animation.setProperty("color"); - animation.setTo(QColor("red")); - QVERIFY(animation.target() == &rect); - QVERIFY(animation.property() == "color"); - QVERIFY(animation.to() == QColor("red")); - animation.start(); - QVERIFY(animation.isRunning()); - QTest::qWait(animation.duration()); - QTIMED_COMPARE(rect.color(), QColor("red")); - - rect.setColor(QColor("blue")); - animation.start(); - animation.pause(); - QVERIFY(animation.isRunning()); - QVERIFY(animation.isPaused()); - animation.setCurrentTime(125); - QVERIFY(animation.currentTime() == 125); - QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); - - rect.setColor(QColor("green")); - animation.setFrom(QColor("blue")); - QVERIFY(animation.from() == QColor("blue")); - animation.restart(); - QCOMPARE(rect.color(), QColor("blue")); - QVERIFY(animation.isRunning()); - animation.setCurrentTime(125); - QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1)); -} - -void tst_qmlanimations::alwaysRunToEnd() -{ - QmlGraphicsRectangle rect; - QmlPropertyAnimation animation; - animation.setTarget(&rect); - animation.setProperty("x"); - animation.setTo(200); - animation.setDuration(1000); - animation.setRepeat(true); - animation.setAlwaysRunToEnd(true); - QVERIFY(animation.repeat() == true); - QVERIFY(animation.alwaysRunToEnd() == true); - animation.start(); - QTest::qWait(1500); - animation.stop(); - QVERIFY(rect.x() != qreal(200)); - QTest::qWait(500); - QTIMED_COMPARE(rect.x(), qreal(200)); -} - -void tst_qmlanimations::complete() -{ - QmlGraphicsRectangle rect; - QmlPropertyAnimation animation; - animation.setTarget(&rect); - animation.setProperty("x"); - animation.setFrom(1); - animation.setTo(200); - animation.setDuration(500); - QVERIFY(animation.from() == 1); - animation.start(); - QTest::qWait(50); - animation.stop(); - QVERIFY(rect.x() != qreal(200)); - animation.start(); - QTest::qWait(50); - QVERIFY(animation.isRunning()); - animation.complete(); - QCOMPARE(rect.x(), qreal(200)); -} - -void tst_qmlanimations::resume() -{ - QmlGraphicsRectangle rect; - QmlPropertyAnimation animation; - animation.setTarget(&rect); - animation.setProperty("x"); - animation.setFrom(10); - animation.setTo(200); - animation.setDuration(500); - QVERIFY(animation.from() == 10); - - animation.start(); - QTest::qWait(100); - animation.pause(); - qreal x = rect.x(); - QVERIFY(x != qreal(200)); - QVERIFY(animation.isRunning()); - QVERIFY(animation.isPaused()); - - animation.resume(); - QVERIFY(animation.isRunning()); - QVERIFY(!animation.isPaused()); - QTest::qWait(100); - animation.stop(); - QVERIFY(rect.x() > x); -} - -void tst_qmlanimations::dotProperty() -{ - QmlGraphicsRectangle rect; - QmlNumberAnimation animation; - animation.setTarget(&rect); - animation.setProperty("border.width"); - animation.setTo(10); - animation.start(); - QTest::qWait(animation.duration()+50); - QTIMED_COMPARE(rect.border()->width(), 10); - - rect.border()->setWidth(0); - animation.start(); - animation.pause(); - animation.setCurrentTime(125); - QVERIFY(animation.currentTime() == 125); - QCOMPARE(rect.border()->width(), 5); -} - -void tst_qmlanimations::badTypes() -{ - //don't crash - { - QmlView *view = new QmlView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/badtype1.qml")); - - view->execute(); - qApp->processEvents(); - - delete view; - } - - //make sure we get a compiler error - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype2.qml")); - QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); - c.create(); - - QVERIFY(c.errors().count() == 1); - QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: double expected")); - } - - //make sure we get a compiler error - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype3.qml")); - QTest::ignoreMessage(QtWarningMsg, "QmlComponent: Component is not ready"); - c.create(); - - QVERIFY(c.errors().count() == 1); - QCOMPARE(c.errors().at(0).description(), QLatin1String("Invalid property assignment: color expected")); - } - - //don't crash - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/badtype4.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("state1"); - QTest::qWait(1000 + 50); - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("MyRect"); - QVERIFY(myRect); - QCOMPARE(myRect->x(),qreal(200)); - } -} - -void tst_qmlanimations::badProperties() -{ - //make sure we get a runtime error - { - QmlEngine engine; - - QmlComponent c1(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml")); - QByteArray message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty1.qml").toString().toUtf8() + ":18:9) Cannot animate non-existent property \"border.colr\""; - QTest::ignoreMessage(QtWarningMsg, message); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c1.create()); - QVERIFY(rect); - - QmlComponent c2(&engine, QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml")); - message = "QML ColorAnimation (" + QUrl::fromLocalFile(SRCDIR "/data/badproperty2.qml").toString().toUtf8() + ":18:9) Cannot animate read-only property \"border\""; - QTest::ignoreMessage(QtWarningMsg, message); - rect = qobject_cast<QmlGraphicsRectangle*>(c2.create()); - QVERIFY(rect); - - //### should we warn here are well? - //rect->setState("state1"); - } -} - -//test animating mixed types with property animation in a transition -//for example, int + real; color + real; etc -void tst_qmlanimations::mixedTypes() -{ - //assumes border.width stays a real -- not real robust - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype1.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("state1"); - QTest::qWait(500); - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("MyRect"); - QVERIFY(myRect); - - //rather inexact -- is there a better way? - QVERIFY(myRect->x() > 100 && myRect->x() < 200); - QVERIFY(myRect->border()->width() > 1 && myRect->border()->width() < 10); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/mixedtype2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("state1"); - QTest::qWait(500); - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("MyRect"); - QVERIFY(myRect); - - //rather inexact -- is there a better way? - QVERIFY(myRect->x() > 100 && myRect->x() < 200); - QVERIFY(myRect->color() != QColor("red") && myRect->color() != QColor("blue")); - } -} - -void tst_qmlanimations::properties() -{ - const int waitDuration = 300; - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(200)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(200)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties3.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(300)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties4.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->y(),qreal(200)); - QTIMED_COMPARE(myRect->x(),qreal(100)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/properties5.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(100)); - QTIMED_COMPARE(myRect->y(),qreal(200)); - } -} - -void tst_qmlanimations::propertiesTransition() -{ - const int waitDuration = 300; - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(200)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(200)); - QCOMPARE(myRect->y(),qreal(100)); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->y(),qreal(200)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition3.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(200)); - QCOMPARE(myRect->y(),qreal(100)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition4.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(100)); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(200)); - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition5.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(100)); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(200)); - } - - /*{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/propertiesTransition6.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *myRect = rect->findChild<QmlGraphicsRectangle*>("TheRect"); - QVERIFY(myRect); - rect->setState("moved"); - QCOMPARE(myRect->x(),qreal(100)); - QTest::qWait(waitDuration); - QTIMED_COMPARE(myRect->x(),qreal(100)); - }*/ -} - -void tst_qmlanimations::easingStringConversion() -{ - QmlNumberAnimation *animation = new QmlNumberAnimation; - animation->setEasing("easeInOutQuad"); - QCOMPARE(animation->easing(),QLatin1String("easeInOutQuad")); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::InOutQuad)); - - animation->setEasing("OutQuad"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve(), QEasingCurve(QEasingCurve::OutQuad)); - - animation->setEasing("easeOutBounce(amplitude: 5)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutBounce); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - - animation->setEasing("easeOutElastic(amplitude: 5, period: 3)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutElastic); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude(), qreal(5)); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().period(), qreal(3)); - - animation->setEasing("easeInOutBack(overshoot: 2)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutBack); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().overshoot(), qreal(2)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unmatched parenthesis in easing function \"easeInOutBack(overshoot: 2\""); - animation->setEasing("easeInOutBack(overshoot: 2"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Easing function \"InOutBack(overshoot: 2)\" must start with \"ease\""); - animation->setEasing("InOutBack(overshoot: 2)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing curve \"NonExistantEase\""); - animation->setEasing("NonExistantEase"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::Linear); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude 5)\""); - animation->setEasing("easeInOutElastic(amplitude 5)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Improperly specified parameter in easing function \"easeInOutElastic(amplitude: yes)\""); - animation->setEasing("easeInOutElastic(amplitude: yes)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::InOutElastic); - QVERIFY(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().amplitude() != qreal(5)); - - QTest::ignoreMessage(QtWarningMsg, "QML NumberAnimation (unknown location) Unknown easing parameter \"nonexistentproperty\""); - animation->setEasing("easeOutQuad(nonexistentproperty: 12)"); - QCOMPARE(static_cast<QVariantAnimation*>(((QmlAbstractAnimation*)animation)->qtAnimation())->easingCurve().type(), QEasingCurve::OutQuad); - - delete animation; -} - -void tst_qmlanimations::invalidDuration() -{ - QmlPropertyAnimation *animation = new QmlPropertyAnimation; - QTest::ignoreMessage(QtWarningMsg, "QML PropertyAnimation (unknown location) Cannot set a duration of < 0"); - animation->setDuration(-1); - QCOMPARE(animation->duration(), 250); - - QmlPauseAnimation *pauseAnimation = new QmlPauseAnimation; - QTest::ignoreMessage(QtWarningMsg, "QML PauseAnimation (unknown location) Cannot set a duration of < 0"); - pauseAnimation->setDuration(-1); - QCOMPARE(pauseAnimation->duration(), 250); -} - -void tst_qmlanimations::attached() -{ - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/attached.qml")); - QTest::ignoreMessage(QtDebugMsg, "off"); - QTest::ignoreMessage(QtDebugMsg, "on"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); -} - -void tst_qmlanimations::propertyValueSourceDefaultStart() -{ - { - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource.qml")); - - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim); - QVERIFY(myAnim->isRunning()); - } - - { - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/valuesource2.qml")); - - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim); - QVERIFY(myAnim->isRunning() == false); - } - - { - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontAutoStart.qml")); - - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); - } -} - - -void tst_qmlanimations::dontStart() -{ - { - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); - - QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); - } - - { - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart2.qml")); - - QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); - } -} - -QTEST_MAIN(tst_qmlanimations) - -#include "tst_qmlanimations.moc" diff --git a/tests/auto/declarative/qmlbehaviors/qmlbehaviors.pro b/tests/auto/declarative/qmlbehaviors/qmlbehaviors.pro deleted file mode 100644 index 1e685ee..0000000 --- a/tests/auto/declarative/qmlbehaviors/qmlbehaviors.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlbehaviors.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp b/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp deleted file mode 100644 index e31b600..0000000 --- a/tests/auto/declarative/qmlbehaviors/tst_qmlbehaviors.cpp +++ /dev/null @@ -1,301 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <private/qmlbehavior_p.h> -#include <private/qmlanimation_p.h> - -class tst_qmlbehaviors : public QObject -{ - Q_OBJECT -public: - tst_qmlbehaviors() {} - -private slots: - void simpleBehavior(); - void scriptTriggered(); - void cppTriggered(); - void loop(); - void colorBehavior(); - void parentBehavior(); - void replaceBinding(); - //void transitionOverrides(); - void group(); - void emptyBehavior(); - void explicitSelection(); - void nonSelectingBehavior(); - void reassignedAnimation(); - void disabled(); - void dontStart(); -}; - -void tst_qmlbehaviors::simpleBehavior() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/simple.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - QVERIFY(qobject_cast<QmlBehavior*>(rect->findChild<QmlBehavior*>("MyBehavior"))->animation()); - - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered -} - -void tst_qmlbehaviors::scriptTriggered() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/scripttrigger.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setColor(QColor("red")); - QTest::qWait(200); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered -} - -void tst_qmlbehaviors::cppTriggered() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/cpptrigger.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect); - - innerRect->setProperty("x", 200); - QTest::qWait(200); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered -} - -void tst_qmlbehaviors::loop() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/loop.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - //don't crash - rect->setState("moved"); -} - -void tst_qmlbehaviors::colorBehavior() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/color.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("red"); - QTest::qWait(200); - QColor color = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->color(); - QVERIFY(color != QColor("red") && color != QColor("green")); //i.e. the behavior has been triggered -} - -void tst_qmlbehaviors::parentBehavior() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/parent.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("reparented"); - QTest::qWait(200); - QmlGraphicsItem *newParent = rect->findChild<QmlGraphicsItem*>("NewParent"); - QmlGraphicsItem *parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem(); - QVERIFY(parent != newParent); - QTest::qWait(600); - parent = rect->findChild<QmlGraphicsRectangle*>("MyRect")->parentItem(); - QVERIFY(parent == newParent); -} - -void tst_qmlbehaviors::replaceBinding() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/binding.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - QTest::qWait(200); - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect); - qreal x = innerRect->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)200); - rect->setProperty("basex", 10); - QCOMPARE(innerRect->x(), (qreal)200); - rect->setProperty("movedx", 210); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)210); - - rect->setState(""); - QTest::qWait(200); - x = innerRect->x(); - QVERIFY(x > 10 && x < 210); //i.e. the behavior has been triggered - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)10); - rect->setProperty("movedx", 200); - QCOMPARE(innerRect->x(), (qreal)10); - rect->setProperty("basex", 20); - QTest::qWait(600); - QCOMPARE(innerRect->x(), (qreal)20); -} - -void tst_qmlbehaviors::group() -{ - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - } - - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/groupProperty2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - } -} - -void tst_qmlbehaviors::emptyBehavior() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/empty.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately -} - -void tst_qmlbehaviors::explicitSelection() -{ - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/explicit.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - QTest::qWait(200); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QVERIFY(x > 0 && x < 200); //i.e. the behavior has been triggered - } -} - -void tst_qmlbehaviors::nonSelectingBehavior() -{ - { - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/nonSelecting2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - rect->setState("moved"); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately - } -} - -void tst_qmlbehaviors::reassignedAnimation() -{ - QmlEngine engine; - QmlComponent 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()); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(qobject_cast<QmlNumberAnimation*>( - qobject_cast<QmlBehavior*>( - rect->findChild<QmlBehavior*>("MyBehavior"))->animation())->duration(), 200); -} - -void tst_qmlbehaviors::disabled() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/disabled.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - QCOMPARE(rect->findChild<QmlBehavior*>("MyBehavior")->enabled(), false); - - rect->setState("moved"); - qreal x = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect"))->x(); - QCOMPARE(x, qreal(200)); //should change immediately -} - -void tst_qmlbehaviors::dontStart() -{ - QmlEngine engine; - - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/dontStart.qml")); - - QTest::ignoreMessage(QtWarningMsg, "QmlAbstractAnimation: setRunning() cannot be used on non-root animation nodes"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - QVERIFY(rect); - - QmlAbstractAnimation *myAnim = rect->findChild<QmlAbstractAnimation*>("MyAnim"); - QVERIFY(myAnim && myAnim->qtAnimation()); - QVERIFY(myAnim->qtAnimation()->state() == QAbstractAnimation::Stopped); -} - -QTEST_MAIN(tst_qmlbehaviors) - -#include "tst_qmlbehaviors.moc" diff --git a/tests/auto/declarative/qmlbinding/qmlbinding.pro b/tests/auto/declarative/qmlbinding/qmlbinding.pro deleted file mode 100644 index dfaca91..0000000 --- a/tests/auto/declarative/qmlbinding/qmlbinding.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlbinding.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp b/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp deleted file mode 100644 index 92d1b69..0000000 --- a/tests/auto/declarative/qmlbinding/tst_qmlbinding.cpp +++ /dev/null @@ -1,107 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlbind_p.h> -#include <private/qmlgraphicsrectangle_p.h> -#include "../../../shared/util.h" - -class tst_qmlbinding : public QObject - -{ - Q_OBJECT -public: - tst_qmlbinding(); - -private slots: - void binding(); - void whenAfterValue(); - -private: - QmlEngine engine; -}; - -tst_qmlbinding::tst_qmlbinding() -{ -} - -void tst_qmlbinding::binding() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - - QVERIFY(rect != 0); - QCOMPARE(rect->color(), QColor("yellow")); - QCOMPARE(rect->property("text").toString(), QString("Hello")); - - rect->setProperty("changeColor", true); - QCOMPARE(rect->color(), QColor("red")); - - QmlBind *binding = qobject_cast<QmlBind*>(rect->findChild<QmlBind*>("binding1")); - QVERIFY(binding != 0); - QCOMPARE(binding->object(), rect); - QCOMPARE(binding->property(), QLatin1String("text")); - QCOMPARE(binding->value().toString(), QLatin1String("Hello")); - - delete rect; -} - -void tst_qmlbinding::whenAfterValue() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-binding2.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(c.create()); - - QVERIFY(rect != 0); - QCOMPARE(rect->color(), QColor("yellow")); - QCOMPARE(rect->property("text").toString(), QString("Hello")); - - rect->setProperty("changeColor", true); - QCOMPARE(rect->color(), QColor("red")); - - delete rect; -} - -QTEST_MAIN(tst_qmlbinding) - -#include "tst_qmlbinding.moc" diff --git a/tests/auto/declarative/qmlconnection/data/test-connection.qml b/tests/auto/declarative/qmlconnection/data/test-connection.qml deleted file mode 100644 index 9534621..0000000 --- a/tests/auto/declarative/qmlconnection/data/test-connection.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Qt 4.6 - -Item { - id: screen; width: 50 - - property bool tested: false - signal testMe - - Connection { sender: screen; signal: "widthChanged()"; script: screen.tested = true } -} diff --git a/tests/auto/declarative/qmlconnection/data/test-connection2.qml b/tests/auto/declarative/qmlconnection/data/test-connection2.qml deleted file mode 100644 index 65fe23a..0000000 --- a/tests/auto/declarative/qmlconnection/data/test-connection2.qml +++ /dev/null @@ -1,3 +0,0 @@ -import Qt 4.6 - -Connection { id: connection; sender: connection; signal: "widthChanged()"; script: 1 == 1 } diff --git a/tests/auto/declarative/qmlconnection/data/test-connection3.qml b/tests/auto/declarative/qmlconnection/data/test-connection3.qml deleted file mode 100644 index 32133f9..0000000 --- a/tests/auto/declarative/qmlconnection/data/test-connection3.qml +++ /dev/null @@ -1,3 +0,0 @@ -import Qt 4.6 - -Connection {} diff --git a/tests/auto/declarative/qmlconnection/data/trimming.qml b/tests/auto/declarative/qmlconnection/data/trimming.qml deleted file mode 100644 index c27dc46..0000000 --- a/tests/auto/declarative/qmlconnection/data/trimming.qml +++ /dev/null @@ -1,10 +0,0 @@ -import Qt 4.6 - -Item { - id: screen; width: 50 - - property string tested - signal testMe(int param1, string param2) - - Connection { sender: screen; signal: "testMe(param1, param2)"; script: screen.tested = param2 + param1 } -} diff --git a/tests/auto/declarative/qmlconnection/qmlconnection.pro b/tests/auto/declarative/qmlconnection/qmlconnection.pro deleted file mode 100644 index 3d46fa6..0000000 --- a/tests/auto/declarative/qmlconnection/qmlconnection.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlconnection.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp b/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp deleted file mode 100644 index 2aba7b5..0000000 --- a/tests/auto/declarative/qmlconnection/tst_qmlconnection.cpp +++ /dev/null @@ -1,139 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlconnection_p.h> -#include <private/qmlgraphicsitem_p.h> -#include "../../../shared/util.h" -#include <QtDeclarative/qmlscriptstring.h> - -class tst_qmlconnection : public QObject - -{ - Q_OBJECT -public: - tst_qmlconnection(); - -private slots: - void defaultValues(); - void properties(); - void connection(); - void trimming(); - -private: - QmlEngine engine; -}; - -tst_qmlconnection::tst_qmlconnection() -{ -} - -void tst_qmlconnection::defaultValues() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection3.qml")); - QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); - - QVERIFY(item != 0); - QVERIFY(item->signalSender() == 0); - QCOMPARE(item->script().script(), QString()); - QCOMPARE(item->signal(), QString()); - - delete item; -} - -void tst_qmlconnection::properties() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection2.qml")); - QmlConnection *item = qobject_cast<QmlConnection*>(c.create()); - - QVERIFY(item != 0); - - QVERIFY(item != 0); - QVERIFY(item->signalSender() == item); - QCOMPARE(item->script().script(), QString("1 == 1")); - QCOMPARE(item->signal(), QString("widthChanged()")); - - delete item; -} - -void tst_qmlconnection::connection() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-connection.qml")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(c.create()); - - QVERIFY(item != 0); - - QCOMPARE(item->property("tested").toBool(), false); - QCOMPARE(item->width(), 50.); - emit item->setWidth(100.); - QCOMPARE(item->width(), 100.); - QCOMPARE(item->property("tested").toBool(), true); - - delete item; -} - -void tst_qmlconnection::trimming() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/trimming.qml")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(c.create()); - - QVERIFY(item != 0); - - QCOMPARE(item->property("tested").toString(), QString("")); - int index = item->metaObject()->indexOfSignal("testMe(int,QString)"); - QMetaMethod method = item->metaObject()->method(index); - method.invoke(item, - Qt::DirectConnection, - Q_ARG(int, 5), - Q_ARG(QString, "worked")); - QCOMPARE(item->property("tested").toString(), QString("worked5")); - - delete item; -} - -QTEST_MAIN(tst_qmlconnection) - -#include "tst_qmlconnection.moc" diff --git a/tests/auto/declarative/qmlcontext/qmlcontext.pro b/tests/auto/declarative/qmlcontext/qmlcontext.pro deleted file mode 100644 index 9e66429..0000000 --- a/tests/auto/declarative/qmlcontext/qmlcontext.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlcontext.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlcontext/tst_qmlcontext.cpp b/tests/auto/declarative/qmlcontext/tst_qmlcontext.cpp deleted file mode 100644 index 7ff7af2..0000000 --- a/tests/auto/declarative/qmlcontext/tst_qmlcontext.cpp +++ /dev/null @@ -1,434 +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 <qtest.h> -#include <QDebug> -#include <QmlEngine> -#include <QmlContext> -#include <QmlComponent> -#include <QmlExpression> - -class tst_qmlcontext : public QObject -{ - Q_OBJECT -public: - tst_qmlcontext() {} - -private slots: - void baseUrl(); - void resolvedUrl(); - void engineMethod(); - void parentContext(); - void setContextProperty(); - void addDefaultObject(); - void destruction(); - -private: - QmlEngine engine; -}; - -void tst_qmlcontext::baseUrl() -{ - QmlContext ctxt(&engine); - - QCOMPARE(ctxt.baseUrl(), QUrl()); - - ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); - - QCOMPARE(ctxt.baseUrl(), QUrl("http://www.nokia.com/")); -} - -void tst_qmlcontext::resolvedUrl() -{ - // Relative to the component - { - QmlContext ctxt(&engine); - ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); - - QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), QUrl("http://www.nokia.com/main.qml")); - } - - // Relative to a parent - { - QmlContext ctxt(&engine); - ctxt.setBaseUrl(QUrl("http://www.nokia.com/")); - - QmlContext ctxt2(&ctxt); - QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml")); - } - - // Relative to the engine - { - QmlContext ctxt(&engine); - QCOMPARE(ctxt.resolvedUrl(QUrl("main.qml")), engine.baseUrl().resolved(QUrl("main.qml"))); - } - - // Relative to a deleted parent - { - QmlContext *ctxt = new QmlContext(&engine); - ctxt->setBaseUrl(QUrl("http://www.nokia.com/")); - - QmlContext ctxt2(ctxt); - QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl("http://www.nokia.com/main2.qml")); - - delete ctxt; ctxt = 0; - - QCOMPARE(ctxt2.resolvedUrl(QUrl("main2.qml")), QUrl()); - } - - // Absolute - { - QmlContext ctxt(&engine); - - QCOMPARE(ctxt.resolvedUrl(QUrl("http://www.nokia.com/main2.qml")), QUrl("http://www.nokia.com/main2.qml")); - QCOMPARE(ctxt.resolvedUrl(QUrl("file:///main2.qml")), QUrl("file:///main2.qml")); - } -} - -void tst_qmlcontext::engineMethod() -{ - QmlEngine *engine = new QmlEngine; - - QmlContext ctxt(engine); - QmlContext ctxt2(&ctxt); - QmlContext ctxt3(&ctxt2); - QmlContext ctxt4(&ctxt2); - - QCOMPARE(ctxt.engine(), engine); - QCOMPARE(ctxt2.engine(), engine); - QCOMPARE(ctxt3.engine(), engine); - QCOMPARE(ctxt4.engine(), engine); - - delete engine; engine = 0; - - QCOMPARE(ctxt.engine(), engine); - QCOMPARE(ctxt2.engine(), engine); - QCOMPARE(ctxt3.engine(), engine); - QCOMPARE(ctxt4.engine(), engine); -} - -void tst_qmlcontext::parentContext() -{ - QmlEngine *engine = new QmlEngine; - - QCOMPARE(engine->rootContext()->parentContext(), (QmlContext *)0); - - QmlContext *ctxt = new QmlContext(engine); - QmlContext *ctxt2 = new QmlContext(ctxt); - QmlContext *ctxt3 = new QmlContext(ctxt2); - QmlContext *ctxt4 = new QmlContext(ctxt2); - QmlContext *ctxt5 = new QmlContext(ctxt); - QmlContext *ctxt6 = new QmlContext(engine); - QmlContext *ctxt7 = new QmlContext(engine->rootContext()); - - QCOMPARE(ctxt->parentContext(), engine->rootContext()); - QCOMPARE(ctxt2->parentContext(), ctxt); - QCOMPARE(ctxt3->parentContext(), ctxt2); - QCOMPARE(ctxt4->parentContext(), ctxt2); - QCOMPARE(ctxt5->parentContext(), ctxt); - QCOMPARE(ctxt6->parentContext(), engine->rootContext()); - QCOMPARE(ctxt7->parentContext(), engine->rootContext()); - - delete ctxt2; ctxt2 = 0; - - QCOMPARE(ctxt->parentContext(), engine->rootContext()); - QCOMPARE(ctxt3->parentContext(), ctxt2); - QCOMPARE(ctxt4->parentContext(), ctxt2); - QCOMPARE(ctxt5->parentContext(), ctxt); - QCOMPARE(ctxt6->parentContext(), engine->rootContext()); - QCOMPARE(ctxt7->parentContext(), engine->rootContext()); - - delete engine; engine = 0; - - QCOMPARE(ctxt->parentContext(), (QmlContext *)0); - QCOMPARE(ctxt3->parentContext(), ctxt2); - QCOMPARE(ctxt4->parentContext(), ctxt2); - QCOMPARE(ctxt5->parentContext(), ctxt); - QCOMPARE(ctxt6->parentContext(), (QmlContext *)0); - QCOMPARE(ctxt7->parentContext(), (QmlContext *)0); - - delete ctxt7; - delete ctxt6; - delete ctxt5; - delete ctxt4; - delete ctxt3; - delete ctxt; -} - -class TestObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int a READ a NOTIFY aChanged) - Q_PROPERTY(int b READ b NOTIFY bChanged) - Q_PROPERTY(int c READ c NOTIFY cChanged) - -public: - TestObject() : _a(10), _b(10), _c(10) {} - - int a() const { return _a; } - void setA(int a) { _a = a; emit aChanged(); } - - int b() const { return _b; } - void setB(int b) { _b = b; emit bChanged(); } - - int c() const { return _c; } - void setC(int c) { _c = c; emit cChanged(); } - -signals: - void aChanged(); - void bChanged(); - void cChanged(); - -private: - int _a; - int _b; - int _c; -}; - -class TestObject2 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int b READ b NOTIFY bChanged) - -public: - TestObject2() : _b(10) {} - - int b() const { return _b; } - void setB(int b) { _b = b; emit bChanged(); } - -signals: - void bChanged(); - -private: - int _b; -}; - -#define TEST_CONTEXT_PROPERTY(ctxt, name, value) \ -{ \ - QmlComponent component(&engine); \ - component.setData("import Qt 4.6; QtObject { property var test: " #name " }", QUrl()); \ -\ - QObject *obj = component.create(ctxt); \ -\ - QCOMPARE(obj->property("test"), value); \ -\ - delete obj; \ -} - -void tst_qmlcontext::setContextProperty() -{ - QmlContext ctxt(&engine); - QmlContext ctxt2(&ctxt); - - TestObject obj1; - obj1.setA(3345); - TestObject obj2; - obj2.setA(-19); - - // Static context properties - ctxt.setContextProperty("a", QVariant(10)); - ctxt.setContextProperty("b", QVariant(9)); - ctxt2.setContextProperty("d", &obj2); - ctxt2.setContextProperty("b", QVariant(19)); - ctxt2.setContextProperty("c", QVariant(QString("Hello World!"))); - ctxt.setContextProperty("d", &obj1); - ctxt.setContextProperty("e", &obj1); - - TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(10)); - TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(19)); - TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hello World!"))); - TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(-19)); - TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(3345)); - - ctxt.setContextProperty("a", QVariant(13)); - ctxt.setContextProperty("b", QVariant(4)); - ctxt2.setContextProperty("b", QVariant(8)); - ctxt2.setContextProperty("c", QVariant(QString("Hi World!"))); - ctxt2.setContextProperty("d", &obj1); - obj1.setA(12); - - TEST_CONTEXT_PROPERTY(&ctxt2, a, QVariant(13)); - TEST_CONTEXT_PROPERTY(&ctxt2, b, QVariant(8)); - TEST_CONTEXT_PROPERTY(&ctxt2, c, QVariant(QString("Hi World!"))); - TEST_CONTEXT_PROPERTY(&ctxt2, d.a, QVariant(12)); - TEST_CONTEXT_PROPERTY(&ctxt2, e.a, QVariant(12)); - - // Changes in context properties - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); - - QObject *obj = component.create(&ctxt2); - - QCOMPARE(obj->property("test"), QVariant(13)); - ctxt.setContextProperty("a", QVariant(19)); - QCOMPARE(obj->property("test"), QVariant(19)); - - delete obj; - } - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: b }", QUrl()); - - QObject *obj = component.create(&ctxt2); - - QCOMPARE(obj->property("test"), QVariant(8)); - ctxt.setContextProperty("b", QVariant(5)); - QCOMPARE(obj->property("test"), QVariant(8)); - ctxt2.setContextProperty("b", QVariant(1912)); - QCOMPARE(obj->property("test"), QVariant(1912)); - - delete obj; - } - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: e.a }", QUrl()); - - QObject *obj = component.create(&ctxt2); - - QCOMPARE(obj->property("test"), QVariant(12)); - obj1.setA(13); - QCOMPARE(obj->property("test"), QVariant(13)); - - delete obj; - } - - // New context properties - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); - - QObject *obj = component.create(&ctxt2); - - QCOMPARE(obj->property("test"), QVariant(19)); - ctxt2.setContextProperty("a", QVariant(1945)); - QCOMPARE(obj->property("test"), QVariant(1945)); - - delete obj; - } - - // Setting an object-variant context property - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { id: root; property int a: 10; property int test: ctxtProp.a; property var obj: root; }", QUrl()); - - QmlContext ctxt(engine.rootContext()); - ctxt.setContextProperty("ctxtProp", QVariant()); - - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:1: TypeError: Result of expression 'ctxtProp' [undefined] is not an object."); - QObject *obj = component.create(&ctxt); - - QVariant v = obj->property("obj"); - - ctxt.setContextProperty("ctxtProp", v); - - QCOMPARE(obj->property("test"), QVariant(10)); - - delete obj; - } -} - -void tst_qmlcontext::addDefaultObject() -{ - QmlContext ctxt(&engine); - - TestObject to; - TestObject2 to2; - - to.setA(2); - to.setB(192); - to.setC(18); - to2.setB(111999); - - ctxt.addDefaultObject(&to2); - ctxt.addDefaultObject(&to); - ctxt.setContextProperty("c", QVariant(9)); - - // Static context properties - TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(2)); - TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(111999)); - TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(9)); - - to.setA(12); - to.setB(100); - to.setC(7); - to2.setB(1612); - ctxt.setContextProperty("c", QVariant(3)); - - TEST_CONTEXT_PROPERTY(&ctxt, a, QVariant(12)); - TEST_CONTEXT_PROPERTY(&ctxt, b, QVariant(1612)); - TEST_CONTEXT_PROPERTY(&ctxt, c, QVariant(3)); - - // Changes in context properties - { - QmlComponent component(&engine); - component.setData("import Qt 4.6; QtObject { property var test: a }", QUrl()); - - QObject *obj = component.create(&ctxt); - - QCOMPARE(obj->property("test"), QVariant(12)); - to.setA(14); - QCOMPARE(obj->property("test"), QVariant(14)); - - delete obj; - } -} - -void tst_qmlcontext::destruction() -{ - QmlContext *ctxt = new QmlContext(&engine); - - QObject obj; - QmlEngine::setContextForObject(&obj, ctxt); - QmlExpression expr(ctxt, "a", 0); - - QCOMPARE(ctxt, QmlEngine::contextForObject(&obj)); - QCOMPARE(ctxt, expr.context()); - - delete ctxt; ctxt = 0; - - QCOMPARE(ctxt, QmlEngine::contextForObject(&obj)); - QCOMPARE(ctxt, expr.context()); -} - -QTEST_MAIN(tst_qmlcontext) - -#include "tst_qmlcontext.moc" diff --git a/tests/auto/declarative/qmldatetimeformatter/qmldatetimeformatter.pro b/tests/auto/declarative/qmldatetimeformatter/qmldatetimeformatter.pro deleted file mode 100644 index 2b1947d..0000000 --- a/tests/auto/declarative/qmldatetimeformatter/qmldatetimeformatter.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmldatetimeformatter.cpp diff --git a/tests/auto/declarative/qmldatetimeformatter/tst_qmldatetimeformatter.cpp b/tests/auto/declarative/qmldatetimeformatter/tst_qmldatetimeformatter.cpp deleted file mode 100644 index 4b5dc1d..0000000 --- a/tests/auto/declarative/qmldatetimeformatter/tst_qmldatetimeformatter.cpp +++ /dev/null @@ -1,150 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmldatetimeformatter_p.h> -#include <QDebug> - -class tst_qmldatetimeformatter : public QObject -{ - Q_OBJECT -public: - tst_qmldatetimeformatter() {} - -private slots: - void date(); - void time(); - void dateTime(); -}; - -void tst_qmldatetimeformatter::date() -{ - QmlEngine engine; - QmlComponent formatterComponent(&engine); - formatterComponent.setData(QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"), - QUrl::fromLocalFile("")); - QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QDate date(2008,12,24); - QCOMPARE(formatter->date(), date); - QCOMPARE(formatter->dateTime().date(), date); - QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QVERIFY(formatter->longStyle()); - QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleLongDate)); - - formatter->setDateFormat("ddd MMMM d yy"); - QCOMPARE(formatter->dateFormat(), QLatin1String("ddd MMMM d yy")); - QCOMPARE(formatter->dateText(),date.toString("ddd MMMM d yy")); - - QVERIFY(formatter->timeText().isEmpty()); - QVERIFY(formatter->dateTimeText().isEmpty()); - - delete formatter; -} - -void tst_qmldatetimeformatter::time() -{ - QmlEngine engine; - QmlComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl::fromLocalFile("")); - QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QTime time(14,15,38,200); - - QCOMPARE(formatter->time(),time); - QCOMPARE(formatter->dateTime().time(),time); - - QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleLongDate)); - - formatter->setTimeFormat("H:m:s a"); - QCOMPARE(formatter->timeFormat(), QLatin1String("H:m:s a")); - QCOMPARE(formatter->timeText(),time.toString("H:m:s a")); - - formatter->setTimeFormat("hh:mm:ss.zzz"); - QCOMPARE(formatter->timeText(),time.toString("hh:mm:ss.zzz")); - - QVERIFY(formatter->dateText().isEmpty()); - QVERIFY(formatter->dateTimeText().isEmpty()); - - delete formatter; -} - -void tst_qmldatetimeformatter::dateTime() -{ - QmlEngine engine; - QmlComponent formatterComponent(&engine); - formatterComponent.setData("import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl::fromLocalFile("")); - QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create()); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatter != 0); - - QDateTime dateTime(QDate(1978,03,04),QTime(9,13,54)); - QCOMPARE(formatter->dateTime(),dateTime); - QCOMPARE(formatter->date(),dateTime.date()); - QCOMPARE(formatter->time(),dateTime.time()); - QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleShortDate)); - - formatter->setLongStyle(true); - QCOMPARE(formatter->dateTimeText(),dateTime.toString(Qt::SystemLocaleLongDate)); - - formatter->setDateTimeFormat("M/d/yy H:m:s a"); - QCOMPARE(formatter->dateTimeFormat(), QLatin1String("M/d/yy H:m:s a")); - QCOMPARE(formatter->dateTimeText(),dateTime.toString("M/d/yy H:m:s a")); - - delete formatter; -} - -QTEST_MAIN(tst_qmldatetimeformatter) - -#include "tst_qmldatetimeformatter.moc" diff --git a/tests/auto/declarative/qmldebug/qmldebug.pro b/tests/auto/declarative/qmldebug/qmldebug.pro deleted file mode 100644 index f79829d..0000000 --- a/tests/auto/declarative/qmldebug/qmldebug.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += network declarative -macx:CONFIG -= app_bundle - -HEADERS += ../shared/debugutil_p.h -SOURCES += tst_qmldebug.cpp \ - ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp b/tests/auto/declarative/qmldebug/tst_qmldebug.cpp deleted file mode 100644 index ba07331..0000000 --- a/tests/auto/declarative/qmldebug/tst_qmldebug.cpp +++ /dev/null @@ -1,841 +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 <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> - -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmlmetatype.h> -#include <QtDeclarative/qmlmetaproperty.h> -#include <QtDeclarative/qmlbinding.h> - -#include <private/qmldebug_p.h> -#include <private/qmlenginedebug_p.h> -#include <private/qmldebugclient_p.h> -#include <private/qmldebugservice_p.h> -#include <private/qmlgraphicsrectangle_p.h> - -#include "../shared/debugutil_p.h" - -Q_DECLARE_METATYPE(QmlDebugWatch::State) - - -class tst_QmlDebug : public QObject -{ - Q_OBJECT - -public: - tst_QmlDebug(QmlDebugTestData *data) - { - m_conn = data->conn; - m_engine = data->engine; - m_rootItem = data->items[0]; - } - -private: - QmlDebugObjectReference findRootObject(); - QmlDebugPropertyReference findProperty(const QList<QmlDebugPropertyReference> &props, const QString &name) const; - void waitForQuery(QmlDebugQuery *query); - - void recursiveObjectTest(QObject *o, const QmlDebugObjectReference &oref, bool recursive) const; - - void recursiveCompareObjects(const QmlDebugObjectReference &a, const QmlDebugObjectReference &b) const; - void recursiveCompareContexts(const QmlDebugContextReference &a, const QmlDebugContextReference &b) const; - void compareProperties(const QmlDebugPropertyReference &a, const QmlDebugPropertyReference &b) const; - - QmlDebugConnection *m_conn; - QmlEngineDebug *m_dbg; - QmlEngine *m_engine; - QmlGraphicsItem *m_rootItem; - -private slots: - void initTestCase(); - - void watch_property(); - void watch_object(); - void watch_expression(); - void watch_expression_data(); - void watch_context(); - void watch_file(); - - void queryAvailableEngines(); - void queryRootContexts(); - void queryObject(); - void queryObject_data(); - void queryExpressionResult(); - void queryExpressionResult_data(); - - void tst_QmlDebugFileReference(); - void tst_QmlDebugEngineReference(); - void tst_QmlDebugObjectReference(); - void tst_QmlDebugContextReference(); - void tst_QmlDebugPropertyReference(); -}; - -QmlDebugObjectReference tst_QmlDebug::findRootObject() -{ - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - - if (q_engines->engines().count() == 0) - return QmlDebugObjectReference(); - QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); - waitForQuery(q_context); - - if (q_context->rootContext().objects().count() == 0) - return QmlDebugObjectReference(); - QmlDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); - waitForQuery(q_obj); - - QmlDebugObjectReference result = q_obj->object(); - - delete q_engines; - delete q_context; - delete q_obj; - - return result; -} - -QmlDebugPropertyReference tst_QmlDebug::findProperty(const QList<QmlDebugPropertyReference> &props, const QString &name) const -{ - foreach(const QmlDebugPropertyReference &p, props) { - if (p.name() == name) - return p; - } - return QmlDebugPropertyReference(); -} - -void tst_QmlDebug::waitForQuery(QmlDebugQuery *query) -{ - QVERIFY(query); - QCOMPARE(query->parent(), this); - QVERIFY(query->state() == QmlDebugQuery::Waiting); - if (!QmlDebugTest::waitForSignal(query, SIGNAL(stateChanged(QmlDebugQuery::State)))) - QFAIL("query timed out"); -} - -void tst_QmlDebug::recursiveObjectTest(QObject *o, const QmlDebugObjectReference &oref, bool recursive) const -{ - const QMetaObject *meta = o->metaObject(); - - QmlType *type = QmlMetaType::qmlType(o->metaObject()); - QString className = type ? type->qmlTypeName() : QString(); - className = className.mid(className.lastIndexOf(QLatin1Char('/'))+1); - - QCOMPARE(oref.debugId(), QmlDebugService::idForObject(o)); - QCOMPARE(oref.name(), o->objectName()); - QCOMPARE(oref.className(), className); - QCOMPARE(oref.contextDebugId(), QmlDebugService::idForObject(qmlContext(o))); - - const QObjectList &children = o->children(); - for (int i=0; i<children.count(); i++) { - QObject *child = children[i]; - if (!qmlContext(child)) - continue; - int debugId = QmlDebugService::idForObject(child); - QVERIFY(debugId >= 0); - - QmlDebugObjectReference cref; - foreach (const QmlDebugObjectReference &ref, oref.children()) { - if (ref.debugId() == debugId) { - cref = ref; - break; - } - } - QVERIFY(cref.debugId() >= 0); - - if (recursive) - recursiveObjectTest(child, cref, true); - } - - foreach (const QmlDebugPropertyReference &p, oref.properties()) { - QCOMPARE(p.objectDebugId(), QmlDebugService::idForObject(o)); - - // signal properties are fake - they are generated from QmlBoundSignal children - if (p.name().startsWith("on") && p.name().length() > 2 && p.name()[2].isUpper()) { - QVERIFY(p.value().toString().startsWith('{') && p.value().toString().endsWith('}')); - QVERIFY(p.valueTypeName().isEmpty()); - QVERIFY(p.binding().isEmpty()); - QVERIFY(!p.hasNotifySignal()); - continue; - } - - QMetaProperty pmeta = meta->property(meta->indexOfProperty(p.name().toUtf8().constData())); - - QCOMPARE(p.name(), QString::fromUtf8(pmeta.name())); - - if (pmeta.type() < QVariant::UserType) // TODO test complex types - QCOMPARE(p.value(), pmeta.read(o)); - - if (p.name() == "parent") - QVERIFY(p.valueTypeName() == "QGraphicsObject*" || p.valueTypeName() == "QmlGraphicsItem*"); - else - QCOMPARE(p.valueTypeName(), QString::fromUtf8(pmeta.typeName())); - - QmlAbstractBinding *binding = QmlMetaProperty(o, p.name()).binding(); - if (binding) - QCOMPARE(binding->expression(), p.binding()); - - QCOMPARE(p.hasNotifySignal(), pmeta.hasNotifySignal()); - - QVERIFY(pmeta.isValid()); - } -} - -void tst_QmlDebug::recursiveCompareObjects(const QmlDebugObjectReference &a, const QmlDebugObjectReference &b) const -{ - QCOMPARE(a.debugId(), b.debugId()); - QCOMPARE(a.className(), b.className()); - QCOMPARE(a.name(), b.name()); - QCOMPARE(a.contextDebugId(), b.contextDebugId()); - - QCOMPARE(a.source().url(), b.source().url()); - QCOMPARE(a.source().lineNumber(), b.source().lineNumber()); - QCOMPARE(a.source().columnNumber(), b.source().columnNumber()); - - QCOMPARE(a.properties().count(), b.properties().count()); - QCOMPARE(a.children().count(), b.children().count()); - - QList<QmlDebugPropertyReference> aprops = a.properties(); - QList<QmlDebugPropertyReference> bprops = b.properties(); - - for (int i=0; i<aprops.count(); i++) - compareProperties(aprops[i], bprops[i]); - - for (int i=0; i<a.children().count(); i++) - recursiveCompareObjects(a.children()[i], b.children()[i]); -} - -void tst_QmlDebug::recursiveCompareContexts(const QmlDebugContextReference &a, const QmlDebugContextReference &b) const -{ - QCOMPARE(a.debugId(), b.debugId()); - QCOMPARE(a.name(), b.name()); - QCOMPARE(a.objects().count(), b.objects().count()); - QCOMPARE(a.contexts().count(), b.contexts().count()); - - for (int i=0; i<a.objects().count(); i++) - recursiveCompareObjects(a.objects()[i], b.objects()[i]); - - for (int i=0; i<a.contexts().count(); i++) - recursiveCompareContexts(a.contexts()[i], b.contexts()[i]); -} - -void tst_QmlDebug::compareProperties(const QmlDebugPropertyReference &a, const QmlDebugPropertyReference &b) const -{ - QCOMPARE(a.objectDebugId(), b.objectDebugId()); - QCOMPARE(a.name(), b.name()); - QCOMPARE(a.value(), b.value()); - QCOMPARE(a.valueTypeName(), b.valueTypeName()); - QCOMPARE(a.binding(), b.binding()); - QCOMPARE(a.hasNotifySignal(), b.hasNotifySignal()); -} - -void tst_QmlDebug::initTestCase() -{ - m_dbg = new QmlEngineDebug(m_conn, this); - - qRegisterMetaType<QmlDebugWatch::State>(); -} - -void tst_QmlDebug::watch_property() -{ - QmlDebugObjectReference obj = findRootObject(); - QmlDebugPropertyReference prop = findProperty(obj.properties(), "width"); - - QmlDebugPropertyWatch *watch; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - watch = unconnected->addWatch(prop, this); - QCOMPARE(watch->state(), QmlDebugWatch::Dead); - delete watch; - delete unconnected; - - watch = m_dbg->addWatch(QmlDebugPropertyReference(), this); - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(watch->state(), QmlDebugWatch::Inactive); - delete watch; - - watch = m_dbg->addWatch(prop, this); - QCOMPARE(watch->state(), QmlDebugWatch::Waiting); - QCOMPARE(watch->objectDebugId(), obj.debugId()); - QCOMPARE(watch->name(), prop.name()); - - QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); - - int origWidth = m_rootItem->property("width").toInt(); - m_rootItem->setProperty("width", origWidth*2); - - // stateChanged() is received before valueChanged() - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(watch->state(), QmlDebugWatch::Active); - QCOMPARE(spy.count(), 1); - - m_dbg->removeWatch(watch); - delete watch; - - // restore original value and verify spy doesn't get additional signal since watch has been removed - m_rootItem->setProperty("width", origWidth); - QTest::qWait(100); - QCOMPARE(spy.count(), 1); - - QCOMPARE(spy.at(0).at(0).value<QByteArray>(), prop.name().toUtf8()); - QCOMPARE(spy.at(0).at(1).value<QVariant>(), qVariantFromValue(origWidth*2)); -} - -void tst_QmlDebug::watch_object() -{ - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - - Q_ASSERT(q_engines->engines().count() > 0); - QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); - waitForQuery(q_context); - - Q_ASSERT(q_context->rootContext().objects().count() > 0); - QmlDebugObjectQuery *q_obj = m_dbg->queryObject(q_context->rootContext().objects()[0], this); - waitForQuery(q_obj); - - QmlDebugObjectReference obj = q_obj->object(); - - delete q_engines; - delete q_context; - delete q_obj; - - QmlDebugWatch *watch; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - watch = unconnected->addWatch(obj, this); - QCOMPARE(watch->state(), QmlDebugWatch::Dead); - delete watch; - delete unconnected; - - watch = m_dbg->addWatch(QmlDebugObjectReference(), this); - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(watch->state(), QmlDebugWatch::Inactive); - delete watch; - - watch = m_dbg->addWatch(obj, this); - QCOMPARE(watch->state(), QmlDebugWatch::Waiting); - QCOMPARE(watch->objectDebugId(), obj.debugId()); - - QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); - - int origWidth = m_rootItem->property("width").toInt(); - int origHeight = m_rootItem->property("height").toInt(); - m_rootItem->setProperty("width", origWidth*2); - m_rootItem->setProperty("height", origHeight*2); - - // stateChanged() is received before any valueChanged() signals - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(watch->state(), QmlDebugWatch::Active); - QVERIFY(spy.count() > 0); - - int newWidth = -1; - int newHeight = -1; - for (int i=0; i<spy.count(); i++) { - const QVariantList &values = spy[i]; - if (values[0].value<QByteArray>() == "width") - newWidth = values[1].value<QVariant>().toInt(); - else if (values[0].value<QByteArray>() == "height") - newHeight = values[1].value<QVariant>().toInt(); - - } - - m_dbg->removeWatch(watch); - delete watch; - - // since watch has been removed, restoring the original values should not trigger a valueChanged() - spy.clear(); - m_rootItem->setProperty("width", origWidth); - m_rootItem->setProperty("height", origHeight); - QTest::qWait(100); - QCOMPARE(spy.count(), 0); - - QCOMPARE(newWidth, origWidth * 2); - QCOMPARE(newHeight, origHeight * 2); -} - -void tst_QmlDebug::watch_expression() -{ - QFETCH(QString, expr); - QFETCH(int, increment); - QFETCH(int, incrementCount); - - int origWidth = m_rootItem->property("width").toInt(); - - QmlDebugObjectReference obj = findRootObject(); - - QmlDebugObjectExpressionWatch *watch; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - watch = unconnected->addWatch(obj, expr, this); - QCOMPARE(watch->state(), QmlDebugWatch::Dead); - delete watch; - delete unconnected; - - watch = m_dbg->addWatch(QmlDebugObjectReference(), expr, this); - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(watch->state(), QmlDebugWatch::Inactive); - delete watch; - - watch = m_dbg->addWatch(obj, expr, this); - QCOMPARE(watch->state(), QmlDebugWatch::Waiting); - QCOMPARE(watch->objectDebugId(), obj.debugId()); - QCOMPARE(watch->expression(), expr); - - QSignalSpy spyState(watch, SIGNAL(stateChanged(QmlDebugWatch::State))); - - QSignalSpy spy(watch, SIGNAL(valueChanged(QByteArray,QVariant))); - int expectedSpyCount = incrementCount + 1; // should also get signal with expression's initial value - - int width = origWidth; - for (int i=0; i<incrementCount+1; i++) { - if (i > 0) { - width += increment; - m_rootItem->setProperty("width", width); - } - if (!QmlDebugTest::waitForSignal(watch, SIGNAL(valueChanged(QByteArray,QVariant)))) - QFAIL("Did not receive valueChanged() for expression"); - } - - if (spyState.count() == 0) - QVERIFY(QmlDebugTest::waitForSignal(watch, SIGNAL(stateChanged(QmlDebugWatch::State)))); - QCOMPARE(spyState.count(), 1); - QCOMPARE(watch->state(), QmlDebugWatch::Active); - - m_dbg->removeWatch(watch); - delete watch; - - // restore original value and verify spy doesn't get a signal since watch has been removed - m_rootItem->setProperty("width", origWidth); - QTest::qWait(100); - QCOMPARE(spy.count(), expectedSpyCount); - - width = origWidth + increment; - for (int i=0; i<spy.count(); i++) { - QCOMPARE(spy.at(i).at(1).value<QVariant>().toInt(), width); - width += increment; - } -} - -void tst_QmlDebug::watch_expression_data() -{ - QTest::addColumn<QString>("expr"); - QTest::addColumn<int>("increment"); - QTest::addColumn<int>("incrementCount"); - - QTest::newRow("width") << "width" << 0 << 0; - QTest::newRow("width+10") << "width + 10" << 10 << 5; -} - -void tst_QmlDebug::watch_context() -{ - QmlDebugContextReference c; - QTest::ignoreMessage(QtWarningMsg, "QmlEngineDebug::addWatch(): Not implemented"); - QVERIFY(!m_dbg->addWatch(c, QString(), this)); -} - -void tst_QmlDebug::watch_file() -{ - QmlDebugFileReference f; - QTest::ignoreMessage(QtWarningMsg, "QmlEngineDebug::addWatch(): Not implemented"); - QVERIFY(!m_dbg->addWatch(f, this)); -} - -void tst_QmlDebug::queryAvailableEngines() -{ - QmlDebugEnginesQuery *q_engines; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - q_engines = unconnected->queryAvailableEngines(0); - QCOMPARE(q_engines->state(), QmlDebugQuery::Error); - delete q_engines; - delete unconnected; - - q_engines = m_dbg->queryAvailableEngines(this); - delete q_engines; - - q_engines = m_dbg->queryAvailableEngines(this); - QVERIFY(q_engines->engines().isEmpty()); - waitForQuery(q_engines); - - // TODO test multiple engines - QList<QmlDebugEngineReference> engines = q_engines->engines(); - QCOMPARE(engines.count(), 1); - - foreach(const QmlDebugEngineReference &e, engines) { - QCOMPARE(e.debugId(), QmlDebugService::idForObject(m_engine)); - QCOMPARE(e.name(), m_engine->objectName()); - } - - delete q_engines; -} - -void tst_QmlDebug::queryRootContexts() -{ - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - int engineId = q_engines->engines()[0].debugId(); - - QmlDebugRootContextQuery *q_context; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - q_context = unconnected->queryRootContexts(engineId, this); - QCOMPARE(q_context->state(), QmlDebugQuery::Error); - delete q_context; - delete unconnected; - - q_context = m_dbg->queryRootContexts(engineId, this); - delete q_context; - - q_context = m_dbg->queryRootContexts(engineId, this); - waitForQuery(q_context); - - QmlContext *actualContext = m_engine->rootContext(); - QmlDebugContextReference context = q_context->rootContext(); - QCOMPARE(context.debugId(), QmlDebugService::idForObject(actualContext)); - QCOMPARE(context.name(), actualContext->objectName()); - - QCOMPARE(context.objects().count(), 2); // 2 qml component objects created for context in main() - - // root context query sends only root object data - it doesn't fill in - // the children or property info - QCOMPARE(context.objects()[0].properties().count(), 0); - QCOMPARE(context.objects()[0].children().count(), 0); - - QCOMPARE(context.contexts().count(), 1); - QVERIFY(context.contexts()[0].debugId() >= 0); - QCOMPARE(context.contexts()[0].name(), QString("tst_QmlDebug_childContext")); - - delete q_engines; - delete q_context; -} - -void tst_QmlDebug::queryObject() -{ - QFETCH(bool, recursive); - - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - - QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); - waitForQuery(q_context); - QmlDebugObjectReference rootObject = q_context->rootContext().objects()[0]; - - QmlDebugObjectQuery *q_obj = 0; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - q_obj = recursive ? unconnected->queryObjectRecursive(rootObject, this) : unconnected->queryObject(rootObject, this); - QCOMPARE(q_obj->state(), QmlDebugQuery::Error); - delete q_obj; - delete unconnected; - - q_obj = recursive ? m_dbg->queryObjectRecursive(rootObject, this) : m_dbg->queryObject(rootObject, this); - delete q_obj; - - q_obj = recursive ? m_dbg->queryObjectRecursive(rootObject, this) : m_dbg->queryObject(rootObject, this); - waitForQuery(q_obj); - - QmlDebugObjectReference obj = q_obj->object(); - - delete q_engines; - delete q_context; - delete q_obj; - - // check source as defined in main() - QmlDebugFileReference source = obj.source(); - QCOMPARE(source.url(), QUrl::fromLocalFile("")); - QCOMPARE(source.lineNumber(), 2); - QCOMPARE(source.columnNumber(), 1); - - // generically test all properties, children and childrens' properties - recursiveObjectTest(m_rootItem, obj, recursive); - - if (recursive) { - foreach(const QmlDebugObjectReference &child, obj.children()) - QVERIFY(child.properties().count() > 0); - - QmlDebugObjectReference rect; - QmlDebugObjectReference text; - foreach (const QmlDebugObjectReference &child, obj.children()) { - if (child.className() == "Rectangle") - rect = child; - else if (child.className() == "Text") - text = child; - } - - // test specific property values - QCOMPARE(findProperty(rect.properties(), "width").value(), qVariantFromValue(500)); - QCOMPARE(findProperty(rect.properties(), "height").value(), qVariantFromValue(600)); - QCOMPARE(findProperty(rect.properties(), "color").value(), qVariantFromValue(QColor("blue"))); - - QCOMPARE(findProperty(text.properties(), "color").value(), qVariantFromValue(QColor("blue"))); - - } else { - foreach(const QmlDebugObjectReference &child, obj.children()) - QCOMPARE(child.properties().count(), 0); - } -} - -void tst_QmlDebug::queryObject_data() -{ - QTest::addColumn<bool>("recursive"); - - QTest::newRow("non-recursive") << false; - QTest::newRow("recursive") << true; -} - -void tst_QmlDebug::queryExpressionResult() -{ - QFETCH(QString, expr); - QFETCH(QVariant, result); - - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); // check immediate deletion is ok - - QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); - waitForQuery(q_context); - int objectId = q_context->rootContext().objects()[0].debugId(); - - QmlDebugExpressionQuery *q_expr; - - QmlEngineDebug *unconnected = new QmlEngineDebug(0); - q_expr = unconnected->queryExpressionResult(objectId, expr, this); - QCOMPARE(q_expr->state(), QmlDebugQuery::Error); - delete q_expr; - delete unconnected; - - q_expr = m_dbg->queryExpressionResult(objectId, expr, this); - delete q_expr; - - q_expr = m_dbg->queryExpressionResult(objectId, expr, this); - QCOMPARE(q_expr->expression(), expr); - waitForQuery(q_expr); - - QCOMPARE(q_expr->result(), result); - - delete q_engines; - delete q_context; - delete q_expr; -} - -void tst_QmlDebug::queryExpressionResult_data() -{ - QTest::addColumn<QString>("expr"); - QTest::addColumn<QVariant>("result"); - - QTest::newRow("width + 50") << "width + 50" << qVariantFromValue(60); - QTest::newRow("blueRect.width") << "blueRect.width" << qVariantFromValue(500); - QTest::newRow("bad expr") << "aeaef" << qVariantFromValue(QString("<undefined>")); -} - -void tst_QmlDebug::tst_QmlDebugFileReference() -{ - QmlDebugFileReference ref; - QVERIFY(ref.url().isEmpty()); - QCOMPARE(ref.lineNumber(), -1); - QCOMPARE(ref.columnNumber(), -1); - - ref.setUrl(QUrl("http://test")); - QCOMPARE(ref.url(), QUrl("http://test")); - ref.setLineNumber(1); - QCOMPARE(ref.lineNumber(), 1); - ref.setColumnNumber(1); - QCOMPARE(ref.columnNumber(), 1); - - QmlDebugFileReference copy(ref); - QmlDebugFileReference copyAssign; - copyAssign = ref; - foreach (const QmlDebugFileReference &r, (QList<QmlDebugFileReference>() << copy << copyAssign)) { - QCOMPARE(r.url(), ref.url()); - QCOMPARE(r.lineNumber(), ref.lineNumber()); - QCOMPARE(r.columnNumber(), ref.columnNumber()); - } -} - -void tst_QmlDebug::tst_QmlDebugEngineReference() -{ - QmlDebugEngineReference ref; - QCOMPARE(ref.debugId(), -1); - QVERIFY(ref.name().isEmpty()); - - ref = QmlDebugEngineReference(1); - QCOMPARE(ref.debugId(), 1); - QVERIFY(ref.name().isEmpty()); - - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - ref = q_engines->engines()[0]; - delete q_engines; - - QmlDebugEngineReference copy(ref); - QmlDebugEngineReference copyAssign; - copyAssign = ref; - foreach (const QmlDebugEngineReference &r, (QList<QmlDebugEngineReference>() << copy << copyAssign)) { - QCOMPARE(r.debugId(), ref.debugId()); - QCOMPARE(r.name(), ref.name()); - } -} - -void tst_QmlDebug::tst_QmlDebugObjectReference() -{ - QmlDebugObjectReference ref; - QCOMPARE(ref.debugId(), -1); - QCOMPARE(ref.className(), QString()); - QCOMPARE(ref.name(), QString()); - QCOMPARE(ref.contextDebugId(), -1); - QVERIFY(ref.properties().isEmpty()); - QVERIFY(ref.children().isEmpty()); - - QmlDebugFileReference source = ref.source(); - QVERIFY(source.url().isEmpty()); - QVERIFY(source.lineNumber() < 0); - QVERIFY(source.columnNumber() < 0); - - ref = QmlDebugObjectReference(1); - QCOMPARE(ref.debugId(), 1); - - QmlDebugObjectReference rootObject = findRootObject(); - QmlDebugObjectQuery *query = m_dbg->queryObjectRecursive(rootObject, this); - waitForQuery(query); - ref = query->object(); - delete query; - - QVERIFY(ref.debugId() >= 0); - - QmlDebugObjectReference copy(ref); - QmlDebugObjectReference copyAssign; - copyAssign = ref; - foreach (const QmlDebugObjectReference &r, (QList<QmlDebugObjectReference>() << copy << copyAssign)) - recursiveCompareObjects(r, ref); -} - -void tst_QmlDebug::tst_QmlDebugContextReference() -{ - QmlDebugContextReference ref; - QCOMPARE(ref.debugId(), -1); - QVERIFY(ref.name().isEmpty()); - QVERIFY(ref.objects().isEmpty()); - QVERIFY(ref.contexts().isEmpty()); - - QmlDebugEnginesQuery *q_engines = m_dbg->queryAvailableEngines(this); - waitForQuery(q_engines); - QmlDebugRootContextQuery *q_context = m_dbg->queryRootContexts(q_engines->engines()[0].debugId(), this); - waitForQuery(q_context); - - ref = q_context->rootContext(); - delete q_engines; - delete q_context; - QVERIFY(ref.debugId() >= 0); - - QmlDebugContextReference copy(ref); - QmlDebugContextReference copyAssign; - copyAssign = ref; - foreach (const QmlDebugContextReference &r, (QList<QmlDebugContextReference>() << copy << copyAssign)) - recursiveCompareContexts(r, ref); -} - -void tst_QmlDebug::tst_QmlDebugPropertyReference() -{ - QmlDebugObjectReference rootObject = findRootObject(); - QmlDebugObjectQuery *query = m_dbg->queryObject(rootObject, this); - waitForQuery(query); - QmlDebugObjectReference obj = query->object(); - delete query; - - QmlDebugPropertyReference ref = findProperty(obj.properties(), "scale"); - QVERIFY(ref.objectDebugId() > 0); - QVERIFY(!ref.name().isEmpty()); - QVERIFY(!ref.value().isNull()); - QVERIFY(!ref.valueTypeName().isEmpty()); - QVERIFY(!ref.binding().isEmpty()); - QVERIFY(ref.hasNotifySignal()); - - QmlDebugPropertyReference copy(ref); - QmlDebugPropertyReference copyAssign; - copyAssign = ref; - foreach (const QmlDebugPropertyReference &r, (QList<QmlDebugPropertyReference>() << copy << copyAssign)) - compareProperties(r, ref); -} - - -class tst_QmlDebug_Factory : public QmlTestFactory -{ -public: - QObject *createTest(QmlDebugTestData *data) - { - tst_QmlDebug *test = new tst_QmlDebug(data); - QmlContext *c = new QmlContext(data->engine->rootContext(), test); - c->setObjectName("tst_QmlDebug_childContext"); - return test; - } -}; - -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - QList<QByteArray> qml; - qml << "import Qt 4.6\n" - "Item {" - "width: 10; height: 20; scale: blueRect.scale;" - "Rectangle { id: blueRect; width: 500; height: 600; color: \"blue\"; }" - "Text { color: blueRect.color; }" - "MouseArea {" - "onEntered: { console.log('hello') }" - "}" - "}"; - // add second component to test multiple root contexts - qml << "import Qt 4.6\n" - "Item {}"; - tst_QmlDebug_Factory factory; - return QmlDebugTest::runTests(&factory, qml); -} - -//QTEST_MAIN(tst_QmlDebug) - -#include "tst_qmldebug.moc" diff --git a/tests/auto/declarative/qmldebugclient/qmldebugclient.pro b/tests/auto/declarative/qmldebugclient/qmldebugclient.pro deleted file mode 100644 index 36aa818..0000000 --- a/tests/auto/declarative/qmldebugclient/qmldebugclient.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += network declarative -macx:CONFIG -= app_bundle - -HEADERS += ../shared/debugutil_p.h -SOURCES += tst_qmldebugclient.cpp \ - ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp b/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp deleted file mode 100644 index 3c87d71..0000000 --- a/tests/auto/declarative/qmldebugclient/tst_qmldebugclient.cpp +++ /dev/null @@ -1,157 +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 <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> - -#include <QtDeclarative/qmlengine.h> - -#include <private/qmldebug_p.h> -#include <private/qmlenginedebug_p.h> -#include <private/qmldebugclient_p.h> -#include <private/qmldebugservice_p.h> - -#include "../shared/debugutil_p.h" - -class tst_QmlDebugClient : public QObject -{ - Q_OBJECT - -public: - tst_QmlDebugClient(QmlDebugTestData *data) - { - m_conn = data->conn; - } - - QmlDebugConnection *m_conn; - -private slots: - void name(); - void isEnabled(); - void setEnabled(); - void isConnected(); - void sendMessage(); -}; - -void tst_QmlDebugClient::name() -{ - QString name = "tst_QmlDebugClient::name()"; - - QmlDebugClient client(name, m_conn); - QCOMPARE(client.name(), name); -} - -void tst_QmlDebugClient::isEnabled() -{ - QmlDebugClient client("tst_QmlDebugClient::isEnabled()", m_conn); - QCOMPARE(client.isEnabled(), false); -} - -void tst_QmlDebugClient::setEnabled() -{ - QmlDebugTestService service("tst_QmlDebugClient::setEnabled()"); - QmlDebugTestClient client("tst_QmlDebugClient::setEnabled()", m_conn); - - QCOMPARE(service.isEnabled(), false); - - client.setEnabled(true); - QCOMPARE(client.isEnabled(), true); - QmlDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), true); - - client.setEnabled(false); - QCOMPARE(client.isEnabled(), false); - QmlDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), false); -} - -void tst_QmlDebugClient::isConnected() -{ - QmlDebugClient client1("tst_QmlDebugClient::isConnected() A", m_conn); - QCOMPARE(client1.isConnected(), true); - - QmlDebugConnection conn; - QmlDebugClient client2("tst_QmlDebugClient::isConnected() B", &conn); - QCOMPARE(client2.isConnected(), false); - - QmlDebugClient client3("tst_QmlDebugClient::isConnected() C", 0); - QCOMPARE(client3.isConnected(), false); - - // duplicate plugin name - QTest::ignoreMessage(QtWarningMsg, "QmlDebugClient: Conflicting plugin name \"tst_QmlDebugClient::isConnected() A\" "); - QmlDebugClient client4("tst_QmlDebugClient::isConnected() A", m_conn); - QCOMPARE(client4.isConnected(), false); -} - -void tst_QmlDebugClient::sendMessage() -{ - QmlDebugTestService service("tst_QmlDebugClient::sendMessage()"); - QmlDebugTestClient client("tst_QmlDebugClient::sendMessage()", m_conn); - - QByteArray msg = "hello!"; - - client.sendMessage(msg); - QByteArray resp = client.waitForResponse(); - QCOMPARE(resp, msg); -} - - -class tst_QmlDebugClient_Factory : public QmlTestFactory -{ -public: - QObject *createTest(QmlDebugTestData *data) { return new tst_QmlDebugClient(data); } -}; - - -// This does not use QTEST_MAIN because the test has to be created and run -// in a separate thread. -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - tst_QmlDebugClient_Factory factory; - return QmlDebugTest::runTests(&factory); -} - -#include "tst_qmldebugclient.moc" diff --git a/tests/auto/declarative/qmldebugservice/qmldebugservice.pro b/tests/auto/declarative/qmldebugservice/qmldebugservice.pro deleted file mode 100644 index 9995f1f..0000000 --- a/tests/auto/declarative/qmldebugservice/qmldebugservice.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += network declarative -macx:CONFIG -= app_bundle - -HEADERS += ../shared/debugutil_p.h -SOURCES += tst_qmldebugservice.cpp \ - ../shared/debugutil.cpp diff --git a/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp b/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp deleted file mode 100644 index e9e31ca..0000000 --- a/tests/auto/declarative/qmldebugservice/tst_qmldebugservice.cpp +++ /dev/null @@ -1,190 +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 <qtest.h> -#include <QSignalSpy> -#include <QTimer> -#include <QHostAddress> -#include <QDebug> -#include <QThread> - -#include <QtDeclarative/qmlengine.h> - -#include <private/qmldebug_p.h> -#include <private/qmlenginedebug_p.h> -#include <private/qmldebugclient_p.h> -#include <private/qmldebugservice_p.h> - -#include "../shared/debugutil_p.h" - -class tst_QmlDebugService : public QObject -{ - Q_OBJECT - -public: - tst_QmlDebugService(QmlDebugTestData *data) - { - m_conn = data->conn; - } - - QmlDebugConnection *m_conn; - -private slots: - void name(); - void isEnabled(); - void enabledChanged(); - void sendMessage(); - void idForObject(); - void objectForId(); - void objectToString(); -}; - -void tst_QmlDebugService::name() -{ - QString name = "tst_QmlDebugService::name()"; - - QmlDebugService service(name); - QCOMPARE(service.name(), name); -} - -void tst_QmlDebugService::isEnabled() -{ - QmlDebugTestService service("tst_QmlDebugService::isEnabled()", m_conn); - QCOMPARE(service.isEnabled(), false); - - QmlDebugTestClient client("tst_QmlDebugService::isEnabled()", m_conn); - client.setEnabled(true); - QmlDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.isEnabled(), true); - - QTest::ignoreMessage(QtWarningMsg, "QmlDebugService: Conflicting plugin name \"tst_QmlDebugService::isEnabled()\" "); - QmlDebugService duplicate("tst_QmlDebugService::isEnabled()", m_conn); - QCOMPARE(duplicate.isEnabled(), false); -} - -void tst_QmlDebugService::enabledChanged() -{ - QmlDebugTestService service("tst_QmlDebugService::enabledChanged()"); - QmlDebugTestClient client("tst_QmlDebugService::enabledChanged()", m_conn); - - QCOMPARE(service.enabled, false); - - client.setEnabled(true); - QmlDebugTest::waitForSignal(&service, SIGNAL(enabledStateChanged())); - QCOMPARE(service.enabled, true); -} - -void tst_QmlDebugService::sendMessage() -{ - QmlDebugTestService service("tst_QmlDebugService::sendMessage()"); - QmlDebugTestClient client("tst_QmlDebugService::sendMessage()", m_conn); - - QByteArray msg = "hello!"; - - client.sendMessage(msg); - QByteArray resp = client.waitForResponse(); - QCOMPARE(resp, msg); -} - -void tst_QmlDebugService::idForObject() -{ - QCOMPARE(QmlDebugService::idForObject(0), -1); - - QObject *objA = new QObject; - - int idA = QmlDebugService::idForObject(objA); - QVERIFY(idA >= 0); - QCOMPARE(QmlDebugService::objectForId(idA), objA); - - int idAA = QmlDebugService::idForObject(objA); - QCOMPARE(idAA, idA); - - QObject *objB = new QObject; - int idB = QmlDebugService::idForObject(objB); - QVERIFY(idB != idA); - QCOMPARE(QmlDebugService::objectForId(idB), objB); - - delete objA; - delete objB; -} - -void tst_QmlDebugService::objectForId() -{ - QCOMPARE(QmlDebugService::objectForId(-1), static_cast<QObject*>(0)); - QCOMPARE(QmlDebugService::objectForId(1), static_cast<QObject*>(0)); - - QObject *obj = new QObject; - int id = QmlDebugService::idForObject(obj); - QCOMPARE(QmlDebugService::objectForId(id), obj); - - delete obj; - QCOMPARE(QmlDebugService::objectForId(id), static_cast<QObject*>(0)); -} - -void tst_QmlDebugService::objectToString() -{ - QCOMPARE(QmlDebugService::objectToString(0), QString("NULL")); - - QObject *obj = new QObject; - QCOMPARE(QmlDebugService::objectToString(obj), QString("QObject: <unnamed>")); - - obj->setObjectName("Hello"); - QCOMPARE(QmlDebugService::objectToString(obj), QString("QObject: Hello")); - delete obj; -} - - -class tst_QmlDebugService_Factory : public QmlTestFactory -{ -public: - QObject *createTest(QmlDebugTestData *data) { return new tst_QmlDebugService(data); } -}; - -// This does not use QTEST_MAIN because the test has to be created and run -// in a separate thread. -int main(int argc, char *argv[]) -{ - QApplication app(argc, argv); - - tst_QmlDebugService_Factory factory; - return QmlDebugTest::runTests(&factory); -} - -#include "tst_qmldebugservice.moc" diff --git a/tests/auto/declarative/qmldom/qmldom.pro b/tests/auto/declarative/qmldom/qmldom.pro deleted file mode 100644 index 7ff317d..0000000 --- a/tests/auto/declarative/qmldom/qmldom.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmldom.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmldom/tst_qmldom.cpp b/tests/auto/declarative/qmldom/tst_qmldom.cpp deleted file mode 100644 index 16cdef0..0000000 --- a/tests/auto/declarative/qmldom/tst_qmldom.cpp +++ /dev/null @@ -1,1313 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/private/qmldom_p.h> - -#include <QtCore/QDebug> -#include <QtCore/QFile> - -class tst_qmldom : public QObject -{ - Q_OBJECT -public: - tst_qmldom() {} - -private slots: - void loadSimple(); - void loadProperties(); - void loadGroupedProperties(); - void loadChildObject(); - void loadComposite(); - void loadImports(); - void loadErrors(); - void loadSyntaxErrors(); - void loadRemoteErrors(); - void loadDynamicProperty(); - void loadComponent(); - - void testValueSource(); - void testValueInterceptor(); - - void object_dynamicProperty(); - void object_property(); - void object_url(); - - void copy(); - void position(); -private: - QmlEngine engine; -}; - - -void tst_qmldom::loadSimple() -{ - QByteArray qml = "import Qt 4.6\n" - "Item {}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - QVERIFY(document.errors().isEmpty()); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - QVERIFY(!rootObject.isComponent()); - QVERIFY(!rootObject.isCustomType()); - QVERIFY(rootObject.objectType() == "Qt/Item"); - QVERIFY(rootObject.objectTypeMajorVersion() == 4); - QVERIFY(rootObject.objectTypeMinorVersion() == 6); -} - -// Test regular properties -void tst_qmldom::loadProperties() -{ - QByteArray qml = "import Qt 4.6\n" - "Item { id : item; x : 300; visible : true }"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - QVERIFY(rootObject.objectId() == "item"); - QCOMPARE(rootObject.properties().size(), 3); - - QmlDomProperty xProperty = rootObject.property("x"); - QVERIFY(xProperty.propertyName() == "x"); - QCOMPARE(xProperty.propertyNameParts().count(), 1); - QVERIFY(xProperty.propertyNameParts().at(0) == "x"); - QCOMPARE(xProperty.position(), 32); - QCOMPARE(xProperty.length(), 1); - QVERIFY(xProperty.value().isLiteral()); - QVERIFY(xProperty.value().toLiteral().literal() == "300"); - - QmlDomProperty visibleProperty = rootObject.property("visible"); - QVERIFY(visibleProperty.propertyName() == "visible"); - QCOMPARE(visibleProperty.propertyNameParts().count(), 1); - QVERIFY(visibleProperty.propertyNameParts().at(0) == "visible"); - QCOMPARE(visibleProperty.position(), 41); - QCOMPARE(visibleProperty.length(), 7); - QVERIFY(visibleProperty.value().isLiteral()); - QVERIFY(visibleProperty.value().toLiteral().literal() == "true"); -} - -// Test grouped properties -void tst_qmldom::loadGroupedProperties() -{ - { - QByteArray qml = "import Qt 4.6\n" - "Item { anchors.left: parent.left; anchors.right: parent.right }"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QVERIFY(rootItem.properties().size() == 2); - - // Order is not deterministic - QmlDomProperty p0 = rootItem.properties().at(0); - QmlDomProperty p1 = rootItem.properties().at(1); - QmlDomProperty leftProperty; - QmlDomProperty rightProperty; - if (p0.propertyName() == "anchors.left") { - leftProperty = p0; - rightProperty = p1; - } else { - leftProperty = p1; - rightProperty = p0; - } - - QVERIFY(leftProperty.propertyName() == "anchors.left"); - QCOMPARE(leftProperty.propertyNameParts().count(), 2); - QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); - QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); - QCOMPARE(leftProperty.position(), 21); - QCOMPARE(leftProperty.length(), 12); - QVERIFY(leftProperty.value().isBinding()); - QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); - - QVERIFY(rightProperty.propertyName() == "anchors.right"); - QCOMPARE(rightProperty.propertyNameParts().count(), 2); - QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); - QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); - QCOMPARE(rightProperty.position(), 48); - QCOMPARE(rightProperty.length(), 13); - QVERIFY(rightProperty.value().isBinding()); - QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); - } - - { - QByteArray qml = "import Qt 4.6\n" - "Item { \n" - " anchors {\n" - " left: parent.left\n" - " right: parent.right\n" - " }\n" - "}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QVERIFY(rootItem.properties().size() == 2); - - // Order is not deterministic - QmlDomProperty p0 = rootItem.properties().at(0); - QmlDomProperty p1 = rootItem.properties().at(1); - QmlDomProperty leftProperty; - QmlDomProperty rightProperty; - if (p0.propertyName() == "anchors.left") { - leftProperty = p0; - rightProperty = p1; - } else { - leftProperty = p1; - rightProperty = p0; - } - - QVERIFY(leftProperty.propertyName() == "anchors.left"); - QCOMPARE(leftProperty.propertyNameParts().count(), 2); - QVERIFY(leftProperty.propertyNameParts().at(0) == "anchors"); - QVERIFY(leftProperty.propertyNameParts().at(1) == "left"); - QCOMPARE(leftProperty.position(), 44); - QCOMPARE(leftProperty.length(), 4); - QVERIFY(leftProperty.value().isBinding()); - QVERIFY(leftProperty.value().toBinding().binding() == "parent.left"); - - QVERIFY(rightProperty.propertyName() == "anchors.right"); - QCOMPARE(rightProperty.propertyNameParts().count(), 2); - QVERIFY(rightProperty.propertyNameParts().at(0) == "anchors"); - QVERIFY(rightProperty.propertyNameParts().at(1) == "right"); - QCOMPARE(rightProperty.position(), 70); - QCOMPARE(rightProperty.length(), 5); - QVERIFY(rightProperty.value().isBinding()); - QVERIFY(rightProperty.value().toBinding().binding() == "parent.right"); - } - -} - -void tst_qmldom::loadChildObject() -{ - QByteArray qml = "import Qt 4.6\n" - "Item { Item {} }"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QVERIFY(rootItem.properties().size() == 1); - - QmlDomProperty listProperty = rootItem.properties().at(0); - QVERIFY(listProperty.isDefaultProperty()); - QVERIFY(listProperty.value().isList()); - - QmlDomList list = listProperty.value().toList(); - QVERIFY(list.values().size() == 1); - - QmlDomObject childItem = list.values().first().toObject(); - QVERIFY(childItem.isValid()); - QVERIFY(childItem.objectType() == "Qt/Item"); -} - -void tst_qmldom::loadComposite() -{ - QFile file(SRCDIR "/data/top.qml"); - QVERIFY(file.open(QIODevice::ReadOnly | QIODevice::Text)); - - QmlDomDocument document; - QVERIFY(document.load(&engine, file.readAll(), QUrl::fromLocalFile(file.fileName()))); - QVERIFY(document.errors().isEmpty()); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QCOMPARE(rootItem.objectType(), QByteArray("MyComponent")); - QCOMPARE(rootItem.properties().size(), 2); - - QmlDomProperty widthProperty = rootItem.property("width"); - QVERIFY(widthProperty.value().isLiteral()); - - QmlDomProperty heightProperty = rootItem.property("height"); - QVERIFY(heightProperty.value().isLiteral()); -} - -void tst_qmldom::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); }}"; - - QmlEngine freshEngine; - QmlDomDocument document; - QVERIFY(document.load(&freshEngine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QmlDomProperty heightProperty = rootItem.properties().at(0); - QVERIFY(heightProperty.propertyName() == "height"); - QVERIFY(heightProperty.value().isValueSource()); - - const QmlDomValueValueSource valueSource = heightProperty.value().toValueSource(); - QmlDomObject valueSourceObject = valueSource.object(); - QVERIFY(valueSourceObject.isValid()); - - QVERIFY(valueSourceObject.objectType() == "Qt/SpringFollow"); - - const QmlDomValue springValue = valueSourceObject.property("spring").value(); - QVERIFY(!springValue.isInvalid()); - QVERIFY(springValue.isLiteral()); - QVERIFY(springValue.toLiteral().literal() == "1.4"); - - const QmlDomValue sourceValue = valueSourceObject.property("source").value(); - QVERIFY(!sourceValue.isInvalid()); - QVERIFY(sourceValue.isBinding()); - QVERIFY(sourceValue.toBinding().binding() == "Math.min(Math.max(-130, value*2.2 - 130), 133)"); -} - -void tst_qmldom::testValueInterceptor() -{ - QByteArray qml = "import Qt 4.6\n" - "Rectangle { height: Behavior { NumberAnimation { duration: 100 } } }"; - - QmlEngine freshEngine; - QmlDomDocument document; - QVERIFY(document.load(&freshEngine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QmlDomProperty heightProperty = rootItem.properties().at(0); - QVERIFY(heightProperty.propertyName() == "height"); - QVERIFY(heightProperty.value().isValueInterceptor()); - - const QmlDomValueValueInterceptor valueInterceptor = heightProperty.value().toValueInterceptor(); - QmlDomObject valueInterceptorObject = valueInterceptor.object(); - QVERIFY(valueInterceptorObject.isValid()); - - QVERIFY(valueInterceptorObject.objectType() == "Qt/Behavior"); - - const QmlDomValue animationValue = valueInterceptorObject.property("animation").value(); - QVERIFY(!animationValue.isInvalid()); - QVERIFY(animationValue.isObject()); -} - -// Test QmlDomDocument::imports() -void tst_qmldom::loadImports() -{ - QByteArray qml = "import Qt 4.6\n" - "import importlib.sublib 4.7\n" - "import importlib.sublib 4.6 as NewFoo\n" - "import 'import'\n" - "import 'import' as X\n" - "Item {}"; - - QmlEngine engine; - engine.addImportPath(SRCDIR "/data"); - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QCOMPARE(document.imports().size(), 5); - - QmlDomImport import = document.imports().at(0); - QCOMPARE(import.type(), QmlDomImport::Library); - QCOMPARE(import.uri(), QLatin1String("Qt")); - QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.6")); - - import = document.imports().at(1); - QCOMPARE(import.type(), QmlDomImport::Library); - QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); - QCOMPARE(import.qualifier(), QString()); - QCOMPARE(import.version(), QLatin1String("4.7")); - - import = document.imports().at(2); - QCOMPARE(import.type(), QmlDomImport::Library); - QCOMPARE(import.uri(), QLatin1String("importlib.sublib")); - QCOMPARE(import.qualifier(), QLatin1String("NewFoo")); - QCOMPARE(import.version(), QLatin1String("4.6")); - - import = document.imports().at(3); - QCOMPARE(import.type(), QmlDomImport::File); - QCOMPARE(import.uri(), QLatin1String("import")); - QCOMPARE(import.qualifier(), QLatin1String("")); - QCOMPARE(import.version(), QLatin1String("")); - - import = document.imports().at(4); - QCOMPARE(import.type(), QmlDomImport::File); - QCOMPARE(import.uri(), QLatin1String("import")); - QCOMPARE(import.qualifier(), QLatin1String("X")); - QCOMPARE(import.version(), QLatin1String("")); -} - -// Test loading a file with errors -void tst_qmldom::loadErrors() -{ - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " foo: 12\n" - "}"; - - QmlDomDocument document; - QVERIFY(false == document.load(&engine, qml)); - - QCOMPARE(document.errors().count(), 1); - QmlError error = document.errors().first(); - - QCOMPARE(error.url(), QUrl()); - QCOMPARE(error.line(), 3); - QCOMPARE(error.column(), 3); - QCOMPARE(error.description(), QString("Cannot assign to non-existent property \"foo\"")); -} - -// Test loading a file with syntax errors -void tst_qmldom::loadSyntaxErrors() -{ - QByteArray qml = "import Qt 4.6\n" - "asdf"; - - QmlDomDocument document; - QVERIFY(false == document.load(&engine, qml)); - - QCOMPARE(document.errors().count(), 1); - QmlError error = document.errors().first(); - - QCOMPARE(error.url(), QUrl()); - QCOMPARE(error.line(), 2); - QCOMPARE(error.column(), 1); - QCOMPARE(error.description(), QString("Syntax error")); -} - -// Test attempting to load a file with remote references -void tst_qmldom::loadRemoteErrors() -{ - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " Script {\n" - " source: \"http://localhost/exampleQmlScript.js\"" - " }\n" - "}"; - QmlDomDocument document; - QVERIFY(false == document.load(&engine, qml)); - - QCOMPARE(document.errors().count(), 1); - QmlError error = document.errors().first(); - - QCOMPARE(error.url(), QUrl()); - QCOMPARE(error.line(), -1); - QCOMPARE(error.column(), -1); - QCOMPARE(error.description(), QString("QmlDomDocument supports local types only")); -} - -// Test dynamic property declarations -void tst_qmldom::loadDynamicProperty() -{ - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " property int a\n" - " property bool b\n" - " property double c\n" - " property real d\n" - " property string e\n" - " property url f\n" - " property color g\n" - " property date h\n" - " property var i\n" - " property variant j\n" - " property QtObject k\n" - "}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QCOMPARE(rootObject.dynamicProperties().count(), 11); - -#define DP_TEST(index, name, type, test_position, test_length, propTypeName) \ - { \ - QmlDomDynamicProperty d = rootObject.dynamicProperties().at(index); \ - QVERIFY(d.isValid()); \ - QVERIFY(d.propertyName() == # name ); \ - QVERIFY(d.propertyType() == type); \ - QVERIFY(d.propertyTypeName() == propTypeName); \ - QVERIFY(d.isDefaultProperty() == false); \ - QVERIFY(d.defaultValue().isValid() == false); \ - QCOMPARE(d.position(), test_position); \ - QCOMPARE(d.length(), test_length); \ - } \ - - DP_TEST(0, a, QVariant::Int, 25, 14, "int"); - DP_TEST(1, b, QVariant::Bool, 44, 15, "bool"); - DP_TEST(2, c, QVariant::Double, 64, 17, "double"); - DP_TEST(3, d, QMetaType::QReal, 86, 15, "real"); - DP_TEST(4, e, QVariant::String, 106, 17, "string"); - DP_TEST(5, f, QVariant::Url, 128, 14, "url"); - DP_TEST(6, g, QVariant::Color, 147, 16, "color"); - DP_TEST(7, h, QVariant::Date, 168, 15, "date"); - DP_TEST(8, i, qMetaTypeId<QVariant>(), 188, 14, "var"); - DP_TEST(9, j, qMetaTypeId<QVariant>(), 207, 18, "variant"); - DP_TEST(10, k, -1, 230, 19, "QtObject"); - } - - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " property int a: 12\n" - " property int b: a + 6\n" - " default property QtObject c\n" - "}\n"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QCOMPARE(rootObject.dynamicProperties().count(), 3); - - { - QmlDomDynamicProperty d = rootObject.dynamicProperties().at(0); - QVERIFY(d.isDefaultProperty() == false); - QVERIFY(d.defaultValue().isValid()); - QVERIFY(d.defaultValue().propertyName() == "a"); - QVERIFY(d.defaultValue().value().isLiteral()); - } - - { - QmlDomDynamicProperty d = rootObject.dynamicProperties().at(1); - QVERIFY(d.isDefaultProperty() == false); - QVERIFY(d.defaultValue().isValid()); - QVERIFY(d.defaultValue().propertyName() == "b"); - QVERIFY(d.defaultValue().value().isBinding()); - } - - { - QmlDomDynamicProperty d = rootObject.dynamicProperties().at(2); - QVERIFY(d.isDefaultProperty() == true); - QVERIFY(d.defaultValue().isValid() == false); - } - } -} - -// Test inline components -void tst_qmldom::loadComponent() -{ - // Explicit component - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " Component {\n" - " id: myComponent\n" - " Item {}\n" - " }\n" - "}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QVERIFY(rootItem.properties().size() == 1); - - QmlDomProperty listProperty = rootItem.properties().at(0); - QVERIFY(listProperty.isDefaultProperty()); - QVERIFY(listProperty.value().isList()); - - QmlDomList list = listProperty.value().toList(); - QVERIFY(list.values().size() == 1); - - QmlDomObject componentObject = list.values().first().toObject(); - QVERIFY(componentObject.isValid()); - QVERIFY(componentObject.objectClassName() == "Component"); - QVERIFY(componentObject.isComponent()); - - QmlDomComponent component = componentObject.toComponent(); - QVERIFY(component.isValid()); - QVERIFY(component.objectType() == "Qt/Component"); - QVERIFY(component.objectTypeMajorVersion() == 4); - QVERIFY(component.objectTypeMinorVersion() == 6); - QVERIFY(component.objectClassName() == "Component"); - QVERIFY(component.objectId() == "myComponent"); - QVERIFY(component.properties().isEmpty()); - QVERIFY(component.dynamicProperties().isEmpty()); - QVERIFY(component.isCustomType() == false); - QVERIFY(component.customTypeData() == ""); - QVERIFY(component.isComponent()); - QCOMPARE(component.position(), 25); - QCOMPARE(component.length(), 57); - - QVERIFY(component.componentRoot().isValid()); - QVERIFY(component.componentRoot().objectClassName() == "Item"); - } - - // Implicit component - { - QByteArray qml = "import Qt 4.6\n" - "ListView {\n" - " delegate: Item {}\n" - "}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootItem = document.rootObject(); - QVERIFY(rootItem.isValid()); - QVERIFY(rootItem.properties().size() == 1); - - QmlDomProperty delegate = rootItem.property("delegate"); - - QmlDomObject componentObject = delegate.value().toObject(); - QVERIFY(componentObject.isValid()); - QVERIFY(componentObject.objectClassName() == "Component"); - QVERIFY(componentObject.isComponent()); - - QmlDomComponent component = componentObject.toComponent(); - QVERIFY(component.isValid()); - QVERIFY(component.objectType() == "Qt/Component"); - QVERIFY(component.objectClassName() == "Component"); - QVERIFY(component.objectId() == ""); - QVERIFY(component.properties().isEmpty()); - QVERIFY(component.dynamicProperties().isEmpty()); - QVERIFY(component.isCustomType() == false); - QVERIFY(component.customTypeData() == ""); - QVERIFY(component.isComponent()); - QCOMPARE(component.position(), 39); - QCOMPARE(component.length(), 7); - - QVERIFY(component.componentRoot().isValid()); - QVERIFY(component.componentRoot().objectClassName() == "Item"); - } -} - -// Test QmlDomObject::dynamicProperty() method -void tst_qmldom::object_dynamicProperty() -{ - // Invalid object - { - QmlDomObject object; - QVERIFY(object.dynamicProperty("").isValid() == false); - QVERIFY(object.dynamicProperty("foo").isValid() == false); - } - - - // Valid object, no dynamic properties - { - QByteArray qml = "import Qt 4.6\n" - "Item {}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QVERIFY(rootObject.dynamicProperty("").isValid() == false); - QVERIFY(rootObject.dynamicProperty("foo").isValid() == false); - } - - // Valid object, dynamic properties - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " property int a\n" - "}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QVERIFY(rootObject.dynamicProperty("").isValid() == false); - QVERIFY(rootObject.dynamicProperty("foo").isValid() == false); - - QmlDomDynamicProperty p = rootObject.dynamicProperty("a"); - QVERIFY(p.isValid()); - QVERIFY(p.propertyName() == "a"); - QVERIFY(p.propertyType() == QVariant::Int); - QVERIFY(p.propertyTypeName() == "int"); - QVERIFY(p.isDefaultProperty() == false); - QCOMPARE(p.position(), 25); - QCOMPARE(p.length(), 14); - } - -} - -// Test QmlObject::property() method -void tst_qmldom::object_property() -{ - // Invalid object - { - QmlDomObject object; - QVERIFY(object.property("").isValid() == false); - QVERIFY(object.property("foo").isValid() == false); - } - - // Valid object - no default - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " x: 10\n" - " y: 12\n" - "}\n"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QVERIFY(rootObject.property("").isValid() == false); - QVERIFY(rootObject.property("foo").isValid() == false); - - QmlDomProperty x = rootObject.property("x"); - QVERIFY(x.isValid()); - QVERIFY(x.propertyName() == "x"); - QVERIFY(x.propertyNameParts().count() == 1); - QVERIFY(x.propertyNameParts().at(0) == "x"); - QVERIFY(x.isDefaultProperty() == false); - QVERIFY(x.value().isLiteral()); - QVERIFY(x.value().toLiteral().literal() == "10"); - QCOMPARE(x.position(), 25); - QCOMPARE(x.length(), 1); - - QmlDomProperty y = rootObject.property("y"); - QVERIFY(y.isValid()); - QVERIFY(y.propertyName() == "y"); - QVERIFY(y.propertyNameParts().count() == 1); - QVERIFY(y.propertyNameParts().at(0) == "y"); - QVERIFY(y.isDefaultProperty() == false); - QVERIFY(y.value().isLiteral()); - QVERIFY(y.value().toLiteral().literal() == "12"); - QCOMPARE(y.position(), 35); - QCOMPARE(y.length(), 1); - } - - // Valid object - with default - { - QByteArray qml = "import Qt 4.6\n" - "Item {\n" - " x: 10\n" - " y: 12\n" - " Item {}\n" - "}\n"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - - QVERIFY(rootObject.property("").isValid() == false); - QVERIFY(rootObject.property("foo").isValid() == false); - - QmlDomProperty x = rootObject.property("x"); - QVERIFY(x.isValid()); - QVERIFY(x.propertyName() == "x"); - QVERIFY(x.propertyNameParts().count() == 1); - QVERIFY(x.propertyNameParts().at(0) == "x"); - QVERIFY(x.isDefaultProperty() == false); - QVERIFY(x.value().isLiteral()); - QVERIFY(x.value().toLiteral().literal() == "10"); - QCOMPARE(x.position(), 25); - QCOMPARE(x.length(), 1); - - QmlDomProperty y = rootObject.property("y"); - QVERIFY(y.isValid()); - QVERIFY(y.propertyName() == "y"); - QVERIFY(y.propertyNameParts().count() == 1); - QVERIFY(y.propertyNameParts().at(0) == "y"); - QVERIFY(y.isDefaultProperty() == false); - QVERIFY(y.value().isLiteral()); - QVERIFY(y.value().toLiteral().literal() == "12"); - QCOMPARE(y.position(), 35); - QCOMPARE(y.length(), 1); - - QmlDomProperty data = rootObject.property("data"); - QVERIFY(data.isValid()); - QVERIFY(data.propertyName() == "data"); - QVERIFY(data.propertyNameParts().count() == 1); - QVERIFY(data.propertyNameParts().at(0) == "data"); - QVERIFY(data.isDefaultProperty() == true); - QVERIFY(data.value().isList()); - QCOMPARE(data.position(), 45); - QCOMPARE(data.length(), 0); - } -} - -// Tests the QmlDomObject::url() method -void tst_qmldom::object_url() -{ - // Invalid object - { - QmlDomObject object; - QCOMPARE(object.url(), QUrl()); - } - - // Valid builtin object - { - QByteArray qml = "import Qt 4.6\n" - "Item {}"; - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - QCOMPARE(rootObject.url(), QUrl()); - } - - // Valid composite object - { - QByteArray qml = "import Qt 4.6\n" - "MyItem {}"; - - QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); - QUrl subUrl = QUrl::fromLocalFile(SRCDIR "/data/MyItem.qml"); - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml, myUrl)); - - QmlDomObject rootObject = document.rootObject(); - QVERIFY(rootObject.isValid()); - QCOMPARE(rootObject.url(), subUrl); - } -} - -// Test copy constructors and operators -void tst_qmldom::copy() -{ - QByteArray qml = "import Qt 4.6\n" - "MyItem {\n" - " id: myItem\n" - " property int a: 10\n" - " x: 10\n" - " y: x + 10\n" - " z: NumberAnimation {}\n" - " opacity: Behavior {}\n" - " Component {\n" - " Item{}\n" - " }\n" - " children: [ Item{}, Item{} ]\n" - "}\n"; - - QUrl myUrl = QUrl::fromLocalFile(SRCDIR "/data/main.qml"); - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml, myUrl)); - - // QmlDomDocument - { - QmlDomDocument document2(document); - QmlDomDocument document3; - document3 = document; - - QCOMPARE(document.imports().count(), document2.imports().count()); - QCOMPARE(document.errors().count(), document2.errors().count()); - QCOMPARE(document.rootObject().objectClassName(), document2.rootObject().objectClassName()); - - QCOMPARE(document.imports().count(), document3.imports().count()); - QCOMPARE(document.errors().count(), document3.errors().count()); - QCOMPARE(document.rootObject().objectClassName(), document3.rootObject().objectClassName()); - } - - // QmlDomImport - { - QCOMPARE(document.imports().count(), 1); - QmlDomImport import = document.imports().at(0); - - QmlDomImport import2(import); - QmlDomImport import3; - import3 = import2; - - QCOMPARE(import.type(), import2.type()); - QCOMPARE(import.uri(), import2.uri()); - QCOMPARE(import.version(), import2.version()); - QCOMPARE(import.qualifier(), import2.qualifier()); - - QCOMPARE(import.type(), import3.type()); - QCOMPARE(import.uri(), import3.uri()); - QCOMPARE(import.version(), import3.version()); - QCOMPARE(import.qualifier(), import3.qualifier()); - } - - // QmlDomObject - { - QmlDomObject object = document.rootObject(); - QVERIFY(object.isValid()); - - QmlDomObject object2(object); - QmlDomObject object3; - object3 = object; - - QCOMPARE(object.isValid(), object2.isValid()); - QCOMPARE(object.objectType(), object2.objectType()); - QCOMPARE(object.objectClassName(), object2.objectClassName()); - QCOMPARE(object.objectTypeMajorVersion(), object2.objectTypeMajorVersion()); - QCOMPARE(object.objectTypeMinorVersion(), object2.objectTypeMinorVersion()); - QCOMPARE(object.objectId(), object2.objectId()); - QCOMPARE(object.properties().count(), object2.properties().count()); - QCOMPARE(object.dynamicProperties().count(), object2.dynamicProperties().count()); - QCOMPARE(object.isCustomType(), object2.isCustomType()); - QCOMPARE(object.customTypeData(), object2.customTypeData()); - QCOMPARE(object.isComponent(), object2.isComponent()); - QCOMPARE(object.position(), object2.position()); - QCOMPARE(object.length(), object2.length()); - QCOMPARE(object.url(), object2.url()); - - QCOMPARE(object.isValid(), object3.isValid()); - QCOMPARE(object.objectType(), object3.objectType()); - QCOMPARE(object.objectClassName(), object3.objectClassName()); - QCOMPARE(object.objectTypeMajorVersion(), object3.objectTypeMajorVersion()); - QCOMPARE(object.objectTypeMinorVersion(), object3.objectTypeMinorVersion()); - QCOMPARE(object.objectId(), object3.objectId()); - QCOMPARE(object.properties().count(), object3.properties().count()); - QCOMPARE(object.dynamicProperties().count(), object3.dynamicProperties().count()); - QCOMPARE(object.isCustomType(), object3.isCustomType()); - QCOMPARE(object.customTypeData(), object3.customTypeData()); - QCOMPARE(object.isComponent(), object3.isComponent()); - QCOMPARE(object.position(), object3.position()); - QCOMPARE(object.length(), object3.length()); - QCOMPARE(object.url(), object3.url()); - } - - // QmlDomDynamicProperty - { - QmlDomObject object = document.rootObject(); - QmlDomDynamicProperty property = object.dynamicProperty("a"); - - QmlDomDynamicProperty property2(property); - QmlDomDynamicProperty property3; - property3 = property; - - QCOMPARE(property.isValid(), property2.isValid()); - QCOMPARE(property.propertyName(), property2.propertyName()); - QCOMPARE(property.propertyType(), property2.propertyType()); - QCOMPARE(property.propertyTypeName(), property2.propertyTypeName()); - QCOMPARE(property.isDefaultProperty(), property2.isDefaultProperty()); - QCOMPARE(property.defaultValue().propertyName(), property2.defaultValue().propertyName()); - QCOMPARE(property.position(), property2.position()); - QCOMPARE(property.length(), property2.length()); - - QCOMPARE(property.isValid(), property3.isValid()); - QCOMPARE(property.propertyName(), property3.propertyName()); - QCOMPARE(property.propertyType(), property3.propertyType()); - QCOMPARE(property.propertyTypeName(), property3.propertyTypeName()); - QCOMPARE(property.isDefaultProperty(), property3.isDefaultProperty()); - QCOMPARE(property.defaultValue().propertyName(), property3.defaultValue().propertyName()); - QCOMPARE(property.position(), property3.position()); - QCOMPARE(property.length(), property3.length()); - } - - // QmlDomProperty - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("opacity"); - - QmlDomProperty property2(property); - QmlDomProperty property3; - property3 = property; - - QCOMPARE(property.isValid(), property2.isValid()); - QCOMPARE(property.propertyName(), property2.propertyName()); - QCOMPARE(property.propertyNameParts(), property2.propertyNameParts()); - QCOMPARE(property.isDefaultProperty(), property2.isDefaultProperty()); - QCOMPARE(property.value().type(), property2.value().type()); - QCOMPARE(property.position(), property2.position()); - QCOMPARE(property.length(), property2.length()); - - QCOMPARE(property.isValid(), property3.isValid()); - QCOMPARE(property.propertyName(), property3.propertyName()); - QCOMPARE(property.propertyNameParts(), property3.propertyNameParts()); - QCOMPARE(property.isDefaultProperty(), property3.isDefaultProperty()); - QCOMPARE(property.value().type(), property3.value().type()); - QCOMPARE(property.position(), property3.position()); - QCOMPARE(property.length(), property3.length()); - } - - // QmlDomValueLiteral - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("x"); - QmlDomValueLiteral literal = property.value().toLiteral(); - QCOMPARE(literal.literal(), QString("10")); - - QmlDomValueLiteral literal2(literal); - QmlDomValueLiteral literal3; - literal3 = literal2; - - QCOMPARE(literal2.literal(), QString("10")); - QCOMPARE(literal3.literal(), QString("10")); - } - - - // QmlDomValueBinding - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("y"); - QmlDomValueBinding binding = property.value().toBinding(); - QCOMPARE(binding.binding(), QString("x + 10")); - - QmlDomValueBinding binding2(binding); - QmlDomValueBinding binding3; - binding3 = binding2; - - QCOMPARE(binding2.binding(), QString("x + 10")); - QCOMPARE(binding3.binding(), QString("x + 10")); - } - - // QmlDomValueValueSource - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("z"); - QmlDomValueValueSource source = property.value().toValueSource(); - QCOMPARE(source.object().objectClassName(), QByteArray("NumberAnimation")); - - QmlDomValueValueSource source2(source); - QmlDomValueValueSource source3; - source3 = source; - - QCOMPARE(source2.object().objectClassName(), QByteArray("NumberAnimation")); - QCOMPARE(source3.object().objectClassName(), QByteArray("NumberAnimation")); - } - - // QmlDomValueValueInterceptor - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("opacity"); - QmlDomValueValueInterceptor interceptor = property.value().toValueInterceptor(); - QCOMPARE(interceptor.object().objectClassName(), QByteArray("Behavior")); - - QmlDomValueValueInterceptor interceptor2(interceptor); - QmlDomValueValueInterceptor interceptor3; - interceptor3 = interceptor; - - QCOMPARE(interceptor2.object().objectClassName(), QByteArray("Behavior")); - QCOMPARE(interceptor3.object().objectClassName(), QByteArray("Behavior")); - } - - // QmlDomComponent - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("data"); - QCOMPARE(property.value().toList().values().count(), 1); - QmlDomComponent component = - property.value().toList().values().at(0).toObject().toComponent(); - QCOMPARE(component.componentRoot().objectClassName(), QByteArray("Item")); - - QmlDomComponent component2(component); - QmlDomComponent component3; - component3 = component; - - QCOMPARE(component.componentRoot().objectClassName(), component2.componentRoot().objectClassName()); - QCOMPARE(component.isValid(), component2.isValid()); - QCOMPARE(component.objectType(), component2.objectType()); - QCOMPARE(component.objectClassName(), component2.objectClassName()); - QCOMPARE(component.objectTypeMajorVersion(), component2.objectTypeMajorVersion()); - QCOMPARE(component.objectTypeMinorVersion(), component2.objectTypeMinorVersion()); - QCOMPARE(component.objectId(), component2.objectId()); - QCOMPARE(component.properties().count(), component2.properties().count()); - QCOMPARE(component.dynamicProperties().count(), component2.dynamicProperties().count()); - QCOMPARE(component.isCustomType(), component2.isCustomType()); - QCOMPARE(component.customTypeData(), component2.customTypeData()); - QCOMPARE(component.isComponent(), component2.isComponent()); - QCOMPARE(component.position(), component2.position()); - QCOMPARE(component.length(), component2.length()); - QCOMPARE(component.url(), component2.url()); - - QCOMPARE(component.componentRoot().objectClassName(), component3.componentRoot().objectClassName()); - QCOMPARE(component.isValid(), component3.isValid()); - QCOMPARE(component.objectType(), component3.objectType()); - QCOMPARE(component.objectClassName(), component3.objectClassName()); - QCOMPARE(component.objectTypeMajorVersion(), component3.objectTypeMajorVersion()); - QCOMPARE(component.objectTypeMinorVersion(), component3.objectTypeMinorVersion()); - QCOMPARE(component.objectId(), component3.objectId()); - QCOMPARE(component.properties().count(), component3.properties().count()); - QCOMPARE(component.dynamicProperties().count(), component3.dynamicProperties().count()); - QCOMPARE(component.isCustomType(), component3.isCustomType()); - QCOMPARE(component.customTypeData(), component3.customTypeData()); - QCOMPARE(component.isComponent(), component3.isComponent()); - QCOMPARE(component.position(), component3.position()); - QCOMPARE(component.length(), component3.length()); - QCOMPARE(component.url(), component3.url()); - } - - // QmlDomValue - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("data"); - QmlDomValue value = property.value(); - - QmlDomValue value2(value); - QmlDomValue value3; - value3 = value; - - QCOMPARE(value.type(), value2.type()); - QCOMPARE(value.isInvalid(), value2.isInvalid()); - QCOMPARE(value.isLiteral(), value2.isLiteral()); - QCOMPARE(value.isBinding(), value2.isBinding()); - QCOMPARE(value.isValueSource(), value2.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); - QCOMPARE(value.isObject(), value2.isObject()); - QCOMPARE(value.isList(), value2.isList()); - QCOMPARE(value.position(), value2.position()); - QCOMPARE(value.length(), value2.length()); - - QCOMPARE(value.type(), value3.type()); - QCOMPARE(value.isInvalid(), value3.isInvalid()); - QCOMPARE(value.isLiteral(), value3.isLiteral()); - QCOMPARE(value.isBinding(), value3.isBinding()); - QCOMPARE(value.isValueSource(), value3.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); - QCOMPARE(value.isObject(), value3.isObject()); - QCOMPARE(value.isList(), value3.isList()); - QCOMPARE(value.position(), value3.position()); - QCOMPARE(value.length(), value3.length()); - } - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("x"); - QmlDomValue value = property.value(); - - QmlDomValue value2(value); - QmlDomValue value3; - value3 = value; - - QCOMPARE(value.type(), value2.type()); - QCOMPARE(value.isInvalid(), value2.isInvalid()); - QCOMPARE(value.isLiteral(), value2.isLiteral()); - QCOMPARE(value.isBinding(), value2.isBinding()); - QCOMPARE(value.isValueSource(), value2.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); - QCOMPARE(value.isObject(), value2.isObject()); - QCOMPARE(value.isList(), value2.isList()); - QCOMPARE(value.position(), value2.position()); - QCOMPARE(value.length(), value2.length()); - - QCOMPARE(value.type(), value3.type()); - QCOMPARE(value.isInvalid(), value3.isInvalid()); - QCOMPARE(value.isLiteral(), value3.isLiteral()); - QCOMPARE(value.isBinding(), value3.isBinding()); - QCOMPARE(value.isValueSource(), value3.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); - QCOMPARE(value.isObject(), value3.isObject()); - QCOMPARE(value.isList(), value3.isList()); - QCOMPARE(value.position(), value3.position()); - QCOMPARE(value.length(), value3.length()); - } - { - QmlDomValue value; - - QmlDomValue value2(value); - QmlDomValue value3; - value3 = value; - - QCOMPARE(value.type(), value2.type()); - QCOMPARE(value.isInvalid(), value2.isInvalid()); - QCOMPARE(value.isLiteral(), value2.isLiteral()); - QCOMPARE(value.isBinding(), value2.isBinding()); - QCOMPARE(value.isValueSource(), value2.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value2.isValueInterceptor()); - QCOMPARE(value.isObject(), value2.isObject()); - QCOMPARE(value.isList(), value2.isList()); - QCOMPARE(value.position(), value2.position()); - QCOMPARE(value.length(), value2.length()); - - QCOMPARE(value.type(), value3.type()); - QCOMPARE(value.isInvalid(), value3.isInvalid()); - QCOMPARE(value.isLiteral(), value3.isLiteral()); - QCOMPARE(value.isBinding(), value3.isBinding()); - QCOMPARE(value.isValueSource(), value3.isValueSource()); - QCOMPARE(value.isValueInterceptor(), value3.isValueInterceptor()); - QCOMPARE(value.isObject(), value3.isObject()); - QCOMPARE(value.isList(), value3.isList()); - QCOMPARE(value.position(), value3.position()); - QCOMPARE(value.length(), value3.length()); - } - - // QmlDomList - { - QmlDomObject object = document.rootObject(); - QmlDomProperty property = object.property("children"); - QmlDomList list = property.value().toList(); - QCOMPARE(list.values().count(), 2); - - QmlDomList list2(list); - QmlDomList list3; - list3 = list2; - - QCOMPARE(list.values().count(), list2.values().count()); - QCOMPARE(list.position(), list2.position()); - QCOMPARE(list.length(), list2.length()); - QCOMPARE(list.commaPositions(), list2.commaPositions()); - - QCOMPARE(list.values().count(), list3.values().count()); - QCOMPARE(list.position(), list3.position()); - QCOMPARE(list.length(), list3.length()); - QCOMPARE(list.commaPositions(), list3.commaPositions()); - - } -} - -// Tests the position/length of various elements -void tst_qmldom::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"; - - - QmlDomDocument document; - QVERIFY(document.load(&engine, qml)); - - QmlDomObject root = document.rootObject(); - - // All QmlDomDynamicProperty - QmlDomDynamicProperty dynProp = root.dynamicProperty("a"); - QCOMPARE(dynProp.position(), 40); - QCOMPARE(dynProp.length(), 18); - - // All QmlDomProperty - QmlDomProperty x = root.property("x"); - QCOMPARE(x.position(), 63); - QCOMPARE(x.length(), 1); - - QmlDomProperty y = root.property("y"); - QCOMPARE(y.position(), 73); - QCOMPARE(y.length(), 1); - - QmlDomProperty z = root.property("z"); - QCOMPARE(z.position(), 87); - QCOMPARE(z.length(), 1); - - QmlDomProperty opacity = root.property("opacity"); - QCOMPARE(opacity.position(), 113); - QCOMPARE(opacity.length(), 7); - - QmlDomProperty data = root.property("data"); - QCOMPARE(data.position(), 138); - QCOMPARE(data.length(), 0); - - QmlDomProperty children = root.property("children"); - QCOMPARE(children.position(), 175); - QCOMPARE(children.length(), 8); - - QmlDomList dataList = data.value().toList(); - QCOMPARE(dataList.values().count(), 1); - QmlDomList childrenList = children.value().toList(); - QCOMPARE(childrenList.values().count(), 2); - - // All QmlDomObject - QCOMPARE(root.position(), 14); - QCOMPARE(root.length(), 191); - - QmlDomObject numberAnimation = z.value().toValueSource().object(); - QCOMPARE(numberAnimation.position(), 90); - QCOMPARE(numberAnimation.length(), 18); - - QmlDomObject behavior = opacity.value().toValueInterceptor().object(); - QCOMPARE(behavior.position(), 122); - QCOMPARE(behavior.length(), 11); - - QmlDomObject component = dataList.values().at(0).toObject(); - QCOMPARE(component.position(), 138); - QCOMPARE(component.length(), 32); - - QmlDomObject componentRoot = component.toComponent().componentRoot(); - QCOMPARE(componentRoot.position(), 158); - QCOMPARE(componentRoot.length(), 6); - - QmlDomObject child1 = childrenList.values().at(0).toObject(); - QCOMPARE(child1.position(), 187); - QCOMPARE(child1.length(), 6); - - QmlDomObject child2 = childrenList.values().at(1).toObject(); - QCOMPARE(child2.position(), 195); - QCOMPARE(child2.length(), 6); - - // All QmlDomValue - QmlDomValue xValue = x.value(); - QCOMPARE(xValue.position(), 66); - QCOMPARE(xValue.length(), 2); - - QmlDomValue yValue = y.value(); - QCOMPARE(yValue.position(), 76); - QCOMPARE(yValue.length(), 6); - - QmlDomValue zValue = z.value(); - QCOMPARE(zValue.position(), 90); - QCOMPARE(zValue.length(), 18); - - QmlDomValue opacityValue = opacity.value(); - QCOMPARE(opacityValue.position(), 122); - QCOMPARE(opacityValue.length(), 11); - - QmlDomValue dataValue = data.value(); - QCOMPARE(dataValue.position(), 138); - QCOMPARE(dataValue.length(), 32); - - QmlDomValue child1Value = childrenList.values().at(0); - QCOMPARE(child1Value.position(), 187); - QCOMPARE(child1Value.length(), 6); - - QmlDomValue child2Value = childrenList.values().at(1); - QCOMPARE(child2Value.position(), 195); - QCOMPARE(child2Value.length(), 6); - - // All QmlDomList - qWarning("QmlListValue position test required"); -} - -QTEST_MAIN(tst_qmldom) - -#include "tst_qmldom.moc" diff --git a/tests/auto/declarative/qmleasefollow/qmleasefollow.pro b/tests/auto/declarative/qmleasefollow/qmleasefollow.pro deleted file mode 100644 index 4224a7e..0000000 --- a/tests/auto/declarative/qmleasefollow/qmleasefollow.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmleasefollow.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp b/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp deleted file mode 100644 index f28311f..0000000 --- a/tests/auto/declarative/qmleasefollow/tst_qmleasefollow.cpp +++ /dev/null @@ -1,122 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmleasefollow_p.h> -#include <private/qmlvaluetype_p.h> -#include "../../../shared/util.h" - -class tst_qmleasefollow : public QObject -{ - Q_OBJECT -public: - tst_qmleasefollow(); - -private slots: - void defaultValues(); - void values(); - void disabled(); - -private: - QmlEngine engine; -}; - -tst_qmleasefollow::tst_qmleasefollow() -{ -} - -void tst_qmleasefollow::defaultValues() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow1.qml")); - QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 0.); - QCOMPARE(obj->velocity(), 200.); - QCOMPARE(obj->enabled(), true); - QCOMPARE(obj->duration(), -1.); - QCOMPARE(obj->maximumEasingTime(), -1.); - QCOMPARE(obj->reversingMode(), QmlEaseFollow::Eased); - - delete obj; -} - -void tst_qmleasefollow::values() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow2.qml")); - QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 10.); - QCOMPARE(obj->velocity(), 200.); - QCOMPARE(obj->enabled(), true); - QCOMPARE(obj->duration(), 300.); - QCOMPARE(obj->maximumEasingTime(), -1.); - QCOMPARE(obj->reversingMode(), QmlEaseFollow::Immediate); - - delete obj; -} - -void tst_qmleasefollow::disabled() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/easefollow3.qml")); - QmlEaseFollow *obj = qobject_cast<QmlEaseFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 10.); - QCOMPARE(obj->velocity(), 250.); - QCOMPARE(obj->enabled(), false); - QCOMPARE(obj->maximumEasingTime(), 150.); - QCOMPARE(obj->reversingMode(), QmlEaseFollow::Sync); - - delete obj; -} - -QTEST_MAIN(tst_qmleasefollow) - -#include "tst_qmleasefollow.moc" diff --git a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro b/tests/auto/declarative/qmlecmascript/qmlecmascript.pro deleted file mode 100644 index 9f592e8..0000000 --- a/tests/auto/declarative/qmlecmascript/qmlecmascript.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative script -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlecmascript.cpp \ - testtypes.cpp -HEADERS += testtypes.h - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov diff --git a/tests/auto/declarative/qmlecmascript/testtypes.cpp b/tests/auto/declarative/qmlecmascript/testtypes.cpp deleted file mode 100644 index 3c6b256..0000000 --- a/tests/auto/declarative/qmlecmascript/testtypes.cpp +++ /dev/null @@ -1,82 +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" - -class BaseExtensionObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int baseExtendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); -public: - BaseExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} - - int extendedProperty() const { return m_value; } - void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); } - -signals: - void extendedPropertyChanged(); -private: - int m_value; -}; - -class ExtensionObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int extendedProperty READ extendedProperty WRITE setExtendedProperty NOTIFY extendedPropertyChanged); -public: - ExtensionObject(QObject *parent) : QObject(parent), m_value(0) {} - - int extendedProperty() const { return m_value; } - void setExtendedProperty(int v) { m_value = v; emit extendedPropertyChanged(); } - -signals: - void extendedPropertyChanged(); -private: - int m_value; -}; - -QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlObject,MyQmlObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyDeferredObject,MyDeferredObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyQmlContainer,MyQmlContainer); -QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject); -QML_DEFINE_EXTENDED_TYPE(Qt.test, 1,0, MyExtendedObject,MyExtendedObject,ExtensionObject); -QML_DEFINE_TYPE(Qt.test, 1,0, MyTypeObject, MyTypeObject); - -#include "testtypes.moc" diff --git a/tests/auto/declarative/qmlecmascript/testtypes.h b/tests/auto/declarative/qmlecmascript/testtypes.h deleted file mode 100644 index 0af72cb..0000000 --- a/tests/auto/declarative/qmlecmascript/testtypes.h +++ /dev/null @@ -1,592 +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$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <QtCore/qobject.h> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlexpression.h> -#include <QtCore/qpoint.h> -#include <QtCore/qsize.h> -#include <QtDeclarative/qmllist.h> -#include <QtCore/qrect.h> -#include <QtGui/qmatrix.h> -#include <QtGui/qcolor.h> -#include <QtGui/qvector3d.h> -#include <QtCore/qdatetime.h> -#include <QtScript/qscriptvalue.h> -#include <QtDeclarative/qmlscriptstring.h> -#include <QtDeclarative/qmlcomponent.h> - -class MyQmlAttachedObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int value READ value CONSTANT) -public: - MyQmlAttachedObject(QObject *parent) : QObject(parent) {} - - int value() const { return 19; } -}; - -class MyQmlObject : public QObject -{ - Q_OBJECT - Q_ENUMS(MyEnum) - Q_ENUMS(MyEnum2) - Q_PROPERTY(int deleteOnSet READ deleteOnSet WRITE setDeleteOnSet) - Q_PROPERTY(bool trueProperty READ trueProperty CONSTANT) - Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT) - Q_PROPERTY(int value READ value WRITE setValue) - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged) - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged) - Q_PROPERTY(QmlListProperty<QObject> objectListProperty READ objectListProperty CONSTANT) - Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty) - -public: - MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0), m_value(0), m_resetProperty(13) {} - - enum MyEnum { EnumValue1 = 0, EnumValue2 = 1 }; - enum MyEnum2 { EnumValue3 = 2, EnumValue4 = 3 }; - - bool trueProperty() const { return true; } - bool falseProperty() const { return false; } - - QString stringProperty() const { return m_string; } - void setStringProperty(const QString &s) - { - if (s == m_string) - return; - m_string = s; - emit stringChanged(); - } - - QObject *objectProperty() const { return m_object; } - void setObjectProperty(QObject *obj) { - if (obj == m_object) - return; - m_object = obj; - emit objectChanged(); - } - - QmlListProperty<QObject> objectListProperty() { return QmlListProperty<QObject>(this, m_objectQList); } - - bool methodCalled() const { return m_methodCalled; } - bool methodIntCalled() const { return m_methodIntCalled; } - - QString string() const { return m_string; } - - static MyQmlAttachedObject *qmlAttachedProperties(QObject *o) { - return new MyQmlAttachedObject(o); - } - - int deleteOnSet() const { return 1; } - void setDeleteOnSet(int v) { if(v) delete this; } - - int value() const { return m_value; } - void setValue(int v) { m_value = v; } - - int resettableProperty() const { return m_resetProperty; } - void setResettableProperty(int v) { m_resetProperty = v; } - void resetProperty() { m_resetProperty = 13; } - -signals: - void basicSignal(); - void argumentSignal(int a, QString b, qreal c); - void stringChanged(); - void objectChanged(); - void anotherBasicSignal(); - void thirdBasicSignal(); - -public slots: - void deleteMe() { delete this; } - void methodNoArgs() { m_methodCalled = true; } - void method(int a) { if(a == 163) m_methodIntCalled = true; } - void setString(const QString &s) { m_string = s; } - -private: - friend class tst_qmlecmascript; - bool m_methodCalled; - bool m_methodIntCalled; - - QObject *m_object; - QString m_string; - QList<QObject *> m_objectQList; - int m_value; - int m_resetProperty; -}; - -QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(MyQmlObject); - -class MyQmlContainer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlListProperty<MyQmlObject> children READ children CONSTANT) -public: - MyQmlContainer() {} - - QmlListProperty<MyQmlObject> children() { return QmlListProperty<MyQmlObject>(this, m_children); } - -private: - QList<MyQmlObject*> m_children; -}; - -QML_DECLARE_TYPE(MyQmlContainer); - -class MyExpression : public QmlExpression -{ -public: - MyExpression(QmlContext *ctxt, const QString &expr) - : QmlExpression(ctxt, expr, 0), changed(false) - { - } - - void emitValueChanged() { - changed = true; - QmlExpression::emitValueChanged(); - } - bool changed; -}; - - -class MyDefaultObject1 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int horseLegs READ horseLegs CONSTANT); - Q_PROPERTY(int antLegs READ antLegs CONSTANT); -public: - int horseLegs() const { return 4; } - int antLegs() const { return 6; } -}; - -class MyDefaultObject2 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int emuLegs READ emuLegs CONSTANT); -public: - int antLegs() const { return 5; } // Had an accident - int emuLegs() const { return 2; } -}; - -class MyDefaultObject3 : public QObject -{ - Q_OBJECT - Q_PROPERTY(int antLegs READ antLegs CONSTANT); - Q_PROPERTY(int humanLegs READ humanLegs CONSTANT); -public: - int antLegs() const { return 7; } // Mutant - int humanLegs() const { return 2; } - int millipedeLegs() const { return 1000; } -}; - -class MyDeferredObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int value READ value WRITE setValue NOTIFY valueChanged) - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QObject *objectProperty2 READ objectProperty2 WRITE setObjectProperty2); - Q_CLASSINFO("DeferredPropertyNames", "value,objectProperty,objectProperty2"); - -public: - MyDeferredObject() : m_value(0), m_object(0), m_object2(0) {} - - int value() const { return m_value; } - void setValue(int v) { m_value = v; emit valueChanged(); } - - QObject *objectProperty() const { return m_object; } - void setObjectProperty(QObject *obj) { m_object = obj; } - - QObject *objectProperty2() const { return m_object2; } - void setObjectProperty2(QObject *obj) { m_object2 = obj; } - -signals: - void valueChanged(); - -private: - int m_value; - QObject *m_object; - QObject *m_object2; -}; -QML_DECLARE_TYPE(MyDeferredObject); - -class MyBaseExtendedObject : public QObject -{ -Q_OBJECT -Q_PROPERTY(int baseProperty READ baseProperty WRITE setBaseProperty); -public: - MyBaseExtendedObject() : m_value(0) {} - - int baseProperty() const { return m_value; } - void setBaseProperty(int v) { m_value = v; } - -private: - int m_value; -}; -QML_DECLARE_TYPE(MyBaseExtendedObject); - -class MyExtendedObject : public MyBaseExtendedObject -{ -Q_OBJECT -Q_PROPERTY(int coreProperty READ coreProperty WRITE setCoreProperty); -public: - MyExtendedObject() : m_value(0) {} - - int coreProperty() const { return m_value; } - void setCoreProperty(int v) { m_value = v; } - -private: - int m_value; -}; -QML_DECLARE_TYPE(MyExtendedObject); - -class MyTypeObject : public QObject -{ - Q_OBJECT - Q_ENUMS(MyEnum) - Q_FLAGS(MyFlags) - - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QmlComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); - -public: - MyTypeObject() - : objectPropertyValue(0), componentPropertyValue(0) {} - - QString idValue; - QString id() const { - return idValue; - } - void setId(const QString &v) { - idValue = v; - } - - QObject *objectPropertyValue; - QObject *objectProperty() const { - return objectPropertyValue; - } - void setObjectProperty(QObject *v) { - objectPropertyValue = v; - } - - QmlComponent *componentPropertyValue; - QmlComponent *componentProperty() const { - return componentPropertyValue; - } - void setComponentProperty(QmlComponent *v) { - componentPropertyValue = v; - } - - enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 }; - Q_DECLARE_FLAGS(MyFlags, MyFlag) - MyFlags flagPropertyValue; - MyFlags flagProperty() const { - return flagPropertyValue; - } - void setFlagProperty(MyFlags v) { - flagPropertyValue = v; - } - - enum MyEnum { EnumVal1, EnumVal2 }; - MyEnum enumPropertyValue; - MyEnum enumProperty() const { - return enumPropertyValue; - } - void setEnumProperty(MyEnum v) { - enumPropertyValue = v; - } - - QString stringPropertyValue; - QString stringProperty() const { - return stringPropertyValue; - } - void setStringProperty(const QString &v) { - stringPropertyValue = v; - } - - uint uintPropertyValue; - uint uintProperty() const { - return uintPropertyValue; - } - void setUintProperty(const uint &v) { - uintPropertyValue = v; - } - - int intPropertyValue; - int intProperty() const { - return intPropertyValue; - } - void setIntProperty(const int &v) { - intPropertyValue = v; - } - - qreal realPropertyValue; - qreal realProperty() const { - return realPropertyValue; - } - void setRealProperty(const qreal &v) { - realPropertyValue = v; - } - - double doublePropertyValue; - double doubleProperty() const { - return doublePropertyValue; - } - void setDoubleProperty(const double &v) { - doublePropertyValue = v; - } - - float floatPropertyValue; - float floatProperty() const { - return floatPropertyValue; - } - void setFloatProperty(const float &v) { - floatPropertyValue = v; - } - - QColor colorPropertyValue; - QColor colorProperty() const { - return colorPropertyValue; - } - void setColorProperty(const QColor &v) { - colorPropertyValue = v; - } - - QDate datePropertyValue; - QDate dateProperty() const { - return datePropertyValue; - } - void setDateProperty(const QDate &v) { - datePropertyValue = v; - } - - QTime timePropertyValue; - QTime timeProperty() const { - return timePropertyValue; - } - void setTimeProperty(const QTime &v) { - timePropertyValue = v; - } - - QDateTime dateTimePropertyValue; - QDateTime dateTimeProperty() const { - return dateTimePropertyValue; - } - void setDateTimeProperty(const QDateTime &v) { - dateTimePropertyValue = v; - } - - QPoint pointPropertyValue; - QPoint pointProperty() const { - return pointPropertyValue; - } - void setPointProperty(const QPoint &v) { - pointPropertyValue = v; - } - - QPointF pointFPropertyValue; - QPointF pointFProperty() const { - return pointFPropertyValue; - } - void setPointFProperty(const QPointF &v) { - pointFPropertyValue = v; - } - - QSize sizePropertyValue; - QSize sizeProperty() const { - return sizePropertyValue; - } - void setSizeProperty(const QSize &v) { - sizePropertyValue = v; - } - - QSizeF sizeFPropertyValue; - QSizeF sizeFProperty() const { - return sizeFPropertyValue; - } - void setSizeFProperty(const QSizeF &v) { - sizeFPropertyValue = v; - } - - QRect rectPropertyValue; - QRect rectProperty() const { - return rectPropertyValue; - } - void setRectProperty(const QRect &v) { - rectPropertyValue = v; - emit rectPropertyChanged(); - } - - QRect rectPropertyValue2; - QRect rectProperty2() const { - return rectPropertyValue2; - } - void setRectProperty2(const QRect &v) { - rectPropertyValue2 = v; - } - - QRectF rectFPropertyValue; - QRectF rectFProperty() const { - return rectFPropertyValue; - } - void setRectFProperty(const QRectF &v) { - rectFPropertyValue = v; - } - - bool boolPropertyValue; - bool boolProperty() const { - return boolPropertyValue; - } - void setBoolProperty(const bool &v) { - boolPropertyValue = v; - } - - QVariant variantPropertyValue; - QVariant variantProperty() const { - return variantPropertyValue; - } - void setVariantProperty(const QVariant &v) { - variantPropertyValue = v; - } - - QVector3D vectorPropertyValue; - QVector3D vectorProperty() const { - return vectorPropertyValue; - } - void setVectorProperty(const QVector3D &v) { - vectorPropertyValue = v; - } - - QUrl urlPropertyValue; - QUrl urlProperty() const { - return urlPropertyValue; - } - void setUrlProperty(const QUrl &v) { - urlPropertyValue = v; - } - - QmlScriptString scriptPropertyValue; - QmlScriptString scriptProperty() const { - return scriptPropertyValue; - } - void setScriptProperty(const QmlScriptString &v) { - scriptPropertyValue = v; - } - - void doAction() { emit action(); } -signals: - void action(); - void rectPropertyChanged(); -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) -QML_DECLARE_TYPE(MyTypeObject); - -Q_DECLARE_METATYPE(QScriptValue); -class MyInvokableObject : public QObject -{ - Q_OBJECT -public: - MyInvokableObject() { reset(); } - - int invoked() const { return m_invoked; } - bool error() const { return m_invokedError; } - const QVariantList &actuals() const { return m_actuals; } - void reset() { m_invoked = -1; m_invokedError = false; m_actuals.clear(); } - - Q_INVOKABLE QPointF method_get_QPointF() { return QPointF(99.3, -10.2); } - Q_INVOKABLE QPoint method_get_QPoint() { return QPoint(9, 12); } - - Q_INVOKABLE void method_NoArgs() { invoke(0); } - Q_INVOKABLE int method_NoArgs_int() { invoke(1); return 6; } - Q_INVOKABLE qreal method_NoArgs_real() { invoke(2); return 19.7; } - Q_INVOKABLE QPointF method_NoArgs_QPointF() { invoke(3); return QPointF(123, 4.5); } - Q_INVOKABLE QObject *method_NoArgs_QObject() { invoke(4); return this; } - Q_INVOKABLE MyInvokableObject *method_NoArgs_unknown() { invoke(5); return this; } - Q_INVOKABLE QScriptValue method_NoArgs_QScriptValue() { invoke(6); return QScriptValue("Hello world"); } - Q_INVOKABLE QVariant method_NoArgs_QVariant() { invoke(7); return QVariant("QML rocks"); } - - Q_INVOKABLE void method_int(int a) { invoke(8); m_actuals << a; } - Q_INVOKABLE void method_intint(int a, int b) { invoke(9); m_actuals << a << b; } - Q_INVOKABLE void method_real(qreal a) { invoke(10); m_actuals << a; } - Q_INVOKABLE void method_QString(QString a) { invoke(11); m_actuals << a; } - Q_INVOKABLE void method_QPointF(QPointF a) { invoke(12); m_actuals << a; } - Q_INVOKABLE void method_QObject(QObject *a) { invoke(13); m_actuals << qVariantFromValue(a); } - Q_INVOKABLE void method_QScriptValue(QScriptValue a) { invoke(14); m_actuals << qVariantFromValue(a); } - Q_INVOKABLE void method_intQScriptValue(int a, QScriptValue b) { invoke(15); m_actuals << a << qVariantFromValue(b); } - - Q_INVOKABLE void method_overload(int a) { invoke(16); m_actuals << a; } - Q_INVOKABLE void method_overload(int a, int b) { invoke(17); m_actuals << a << b; } - -private: - void invoke(int idx) { if (m_invoked != -1) m_invokedError = true; m_invoked = idx;} - int m_invoked; - bool m_invokedError; - QVariantList m_actuals; -}; - -#endif // TESTTYPES_H - diff --git a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp b/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp deleted file mode 100644 index b30ad1c..0000000 --- a/tests/auto/declarative/qmlecmascript/tst_qmlecmascript.cpp +++ /dev/null @@ -1,1659 +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 <qtest.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtCore/qfileinfo.h> -#include <QtCore/qdebug.h> -#include <QtDeclarative/private/qmlguard_p.h> -#include <QtCore/qdir.h> -#include <QtCore/qnumeric.h> -#include <private/qmlengine_p.h> -#include <private/qmlglobalscriptclass_p.h> -#include "testtypes.h" - -/* -This test covers evaluation of ECMAScript expressions and bindings from within -QML. This does not include static QML language issues. - -Static QML language issues are covered in qmllanguage -*/ -inline QUrl TEST_FILE(const QString &filename) -{ - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); -} - -inline QUrl TEST_FILE(const char *filename) -{ - return TEST_FILE(QLatin1String(filename)); -} - -class tst_qmlecmascript : public QObject -{ - Q_OBJECT -public: - tst_qmlecmascript() {} - -private slots: - void assignBasicTypes(); - void idShortcutInvalidates(); - void boolPropertiesEvaluateAsBool(); - void methods(); - void signalAssignment(); - void bindingLoop(); - void basicExpressions(); - void basicExpressions_data(); - void arrayExpressions(); - void contextPropertiesTriggerReeval(); - void objectPropertiesTriggerReeval(); - void deferredProperties(); - void extensionObjects(); - void attachedProperties(); - void enums(); - void valueTypeFunctions(); - void constantsOverrideBindings(); - void outerBindingOverridesInnerBinding(); - void aliasPropertyAndBinding(); - void nonExistantAttachedObject(); - void scope(); - void signalParameterTypes(); - void objectsCompareAsEqual(); - void scriptAccess(); - void dynamicCreation_data(); - void dynamicCreation(); - void dynamicDestruction(); - void objectToString(); - void selfDeletingBinding(); - void extendedObjectPropertyLookup(); - void scriptErrors(); - void signalTriggeredBindings(); - void listProperties(); - void exceptionClearsOnReeval(); - void exceptionSlotProducesWarning(); - void exceptionBindingProducesWarning(); - void transientErrors(); - void shutdownErrors(); - void externalScript(); - void compositePropertyType(); - void jsObject(); - void undefinedResetsProperty(); - void listToVariant(); - void multiEngineObject(); - void deletedObject(); - - void bug1(); - - void callQtInvokables(); -private: - QmlEngine engine; -}; - -void tst_qmlecmascript::assignBasicTypes() -{ - { - QmlComponent component(&engine, TEST_FILE("assignBasicTypes.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); - QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); - QCOMPARE(object->stringProperty(), QString("Hello World!")); - QCOMPARE(object->uintProperty(), uint(10)); - QCOMPARE(object->intProperty(), -19); - QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); - QCOMPARE((float)object->floatProperty(), float(8.5)); - QCOMPARE(object->colorProperty(), QColor("red")); - QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); - QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); - QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); - QCOMPARE(object->pointProperty(), QPoint(99,13)); - QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3)); - QCOMPARE(object->sizeProperty(), QSize(99, 13)); - QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2)); - QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); - QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); - QCOMPARE(object->boolProperty(), true); - QCOMPARE(object->variantProperty(), QVariant("Hello World!")); - QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); - QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); - delete object; - } - { - QmlComponent component(&engine, TEST_FILE("assignBasicTypes.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); - QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); - QCOMPARE(object->stringProperty(), QString("Hello World!")); - QCOMPARE(object->uintProperty(), uint(10)); - QCOMPARE(object->intProperty(), -19); - QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); - QCOMPARE((float)object->floatProperty(), float(8.5)); - QCOMPARE(object->colorProperty(), QColor("red")); - QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); - QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); - QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); - QCOMPARE(object->pointProperty(), QPoint(99,13)); - QCOMPARE(object->pointFProperty(), QPointF(-10.1, 12.3)); - QCOMPARE(object->sizeProperty(), QSize(99, 13)); - QCOMPARE(object->sizeFProperty(), QSizeF(0.1, 0.2)); - QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); - QCOMPARE(object->rectFProperty(), QRectF(1000.1, -10.9, 400, 90.99)); - QCOMPARE(object->boolProperty(), true); - QCOMPARE(object->variantProperty(), QVariant("Hello World!")); - QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); - QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); - delete object; - } -} - -void tst_qmlecmascript::idShortcutInvalidates() -{ - { - QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); - delete object->objectProperty(); - QVERIFY(object->objectProperty() == 0); - } - - { - QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.1.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->objectProperty() != 0); - delete object->objectProperty(); - QVERIFY(object->objectProperty() == 0); - } -} - -void tst_qmlecmascript::boolPropertiesEvaluateAsBool() -{ - { - QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->stringProperty(), QLatin1String("pass")); - } - { - QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->stringProperty(), QLatin1String("pass")); - } -} - -void tst_qmlecmascript::signalAssignment() -{ - { - QmlComponent component(&engine, TEST_FILE("signalAssignment.1.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->string(), QString()); - emit object->basicSignal(); - QCOMPARE(object->string(), QString("pass")); - } - - { - QmlComponent component(&engine, TEST_FILE("signalAssignment.2.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->string(), QString()); - emit object->argumentSignal(19, "Hello world!", 10.3); - QCOMPARE(object->string(), QString("pass 19 Hello world! 10.3")); - } -} - -void tst_qmlecmascript::methods() -{ - { - QmlComponent component(&engine, TEST_FILE("methods.1.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->methodCalled(), false); - QCOMPARE(object->methodIntCalled(), false); - emit object->basicSignal(); - QCOMPARE(object->methodCalled(), true); - QCOMPARE(object->methodIntCalled(), false); - } - - { - QmlComponent component(&engine, TEST_FILE("methods.2.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->methodCalled(), false); - QCOMPARE(object->methodIntCalled(), false); - emit object->basicSignal(); - QCOMPARE(object->methodCalled(), false); - QCOMPARE(object->methodIntCalled(), true); - } - - { - QmlComponent component(&engine, TEST_FILE("methods.3.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("test").toInt(), 19); - } - - { - QmlComponent component(&engine, TEST_FILE("methods.4.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("test").toInt(), 19); - QCOMPARE(object->property("test2").toInt(), 17); - QCOMPARE(object->property("test3").toInt(), 16); - } - - { - QmlComponent component(&engine, TEST_FILE("methods.5.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("test").toInt(), 9); - } -} - -void tst_qmlecmascript::bindingLoop() -{ - QmlComponent component(&engine, TEST_FILE("bindingLoop.qml")); - QString warning = "QML MyQmlObject (" + component.url().toString() + ":9:9) Binding loop detected for property \"stringProperty\""; - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -void tst_qmlecmascript::basicExpressions_data() -{ - QTest::addColumn<QString>("expression"); - QTest::addColumn<QVariant>("result"); - QTest::addColumn<bool>("nest"); - - QTest::newRow("Syntax error (self test)") << "{console.log({'a':1'}.a)}" << QVariant() << false; - QTest::newRow("Context property") << "a" << QVariant(1944) << false; - QTest::newRow("Context property") << "a" << QVariant(1944) << true; - QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << false; - QTest::newRow("Context property expression") << "a * 2" << QVariant(3888) << true; - QTest::newRow("Overridden context property") << "b" << QVariant("Milk") << false; - QTest::newRow("Overridden context property") << "b" << QVariant("Cow") << true; - QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << false; - QTest::newRow("Object property") << "object.stringProperty" << QVariant("Object1") << true; - QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object2") << false; - QTest::newRow("Overridden object property") << "objectOverride.stringProperty" << QVariant("Object3") << true; - QTest::newRow("Default object property") << "horseLegs" << QVariant(4) << false; - QTest::newRow("Default object property") << "antLegs" << QVariant(6) << false; - QTest::newRow("Default object property") << "emuLegs" << QVariant(2) << false; - QTest::newRow("Nested default object property") << "horseLegs" << QVariant(4) << true; - QTest::newRow("Nested default object property") << "antLegs" << QVariant(7) << true; - QTest::newRow("Nested default object property") << "emuLegs" << QVariant(2) << true; - QTest::newRow("Nested default object property") << "humanLegs" << QVariant(2) << true; - QTest::newRow("Context property override default object property") << "millipedeLegs" << QVariant(100) << true; -} - -void tst_qmlecmascript::basicExpressions() -{ - QFETCH(QString, expression); - QFETCH(QVariant, result); - QFETCH(bool, nest); - - MyQmlObject object1; - MyQmlObject object2; - MyQmlObject object3; - MyDefaultObject1 default1; - MyDefaultObject2 default2; - MyDefaultObject3 default3; - object1.setStringProperty("Object1"); - object2.setStringProperty("Object2"); - object3.setStringProperty("Object3"); - - QmlContext context(engine.rootContext()); - QmlContext nestedContext(&context); - - context.addDefaultObject(&default1); - context.addDefaultObject(&default2); - context.setContextProperty("a", QVariant(1944)); - context.setContextProperty("b", QVariant("Milk")); - context.setContextProperty("object", &object1); - context.setContextProperty("objectOverride", &object2); - nestedContext.addDefaultObject(&default3); - nestedContext.setContextProperty("b", QVariant("Cow")); - nestedContext.setContextProperty("objectOverride", &object3); - nestedContext.setContextProperty("millipedeLegs", QVariant(100)); - - MyExpression expr(nest?&nestedContext:&context, expression); - QCOMPARE(expr.value(), result); -} - -void tst_qmlecmascript::arrayExpressions() -{ - QObject obj1; - QObject obj2; - QObject obj3; - - QmlContext context(engine.rootContext()); - context.setContextProperty("a", &obj1); - context.setContextProperty("b", &obj2); - context.setContextProperty("c", &obj3); - - MyExpression expr(&context, "[a, b, c, 10]"); - QVariant result = expr.value(); - QCOMPARE(result.userType(), qMetaTypeId<QList<QObject *> >()); - QList<QObject *> list = qvariant_cast<QList<QObject *> >(result); - QCOMPARE(list.count(), 4); - QCOMPARE(list.at(0), &obj1); - QCOMPARE(list.at(1), &obj2); - QCOMPARE(list.at(2), &obj3); - QCOMPARE(list.at(3), (QObject *)0); -} - -// Tests that modifying a context property will reevaluate expressions -void tst_qmlecmascript::contextPropertiesTriggerReeval() -{ - QmlContext context(engine.rootContext()); - MyQmlObject object1; - MyQmlObject object2; - MyQmlObject *object3 = new MyQmlObject; - - object1.setStringProperty("Hello"); - object2.setStringProperty("World"); - - context.setContextProperty("testProp", QVariant(1)); - context.setContextProperty("testObj", &object1); - context.setContextProperty("testObj2", object3); - - { - MyExpression expr(&context, "testProp + 1"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant(2)); - - context.setContextProperty("testProp", QVariant(2)); - QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant(3)); - } - - { - MyExpression expr(&context, "testProp + testProp + testProp"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant(6)); - - context.setContextProperty("testProp", QVariant(4)); - QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant(12)); - } - - { - MyExpression expr(&context, "testObj.stringProperty"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("Hello")); - - context.setContextProperty("testObj", &object2); - QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("World")); - } - - { - MyExpression expr(&context, "testObj.stringProperty /**/"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("World")); - - context.setContextProperty("testObj", &object1); - QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("Hello")); - } - - { - MyExpression expr(&context, "testObj2"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant::fromValue((QObject *)object3)); - } - -} - -void tst_qmlecmascript::objectPropertiesTriggerReeval() -{ - QmlContext context(engine.rootContext()); - MyQmlObject object1; - MyQmlObject object2; - MyQmlObject object3; - context.setContextProperty("testObj", &object1); - - object1.setStringProperty(QLatin1String("Hello")); - object2.setStringProperty(QLatin1String("Dog")); - object3.setStringProperty(QLatin1String("Cat")); - - { - MyExpression expr(&context, "testObj.stringProperty"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant("Hello")); - - object1.setStringProperty(QLatin1String("World")); - QCOMPARE(expr.changed, true); - QCOMPARE(expr.value(), QVariant("World")); - } - - { - MyExpression expr(&context, "testObj.objectProperty.stringProperty"); - QCOMPARE(expr.changed, false); - QCOMPARE(expr.value(), QVariant()); - - object1.setObjectProperty(&object2); - QCOMPARE(expr.changed, true); - expr.changed = false; - QCOMPARE(expr.value(), QVariant("Dog")); - - object1.setObjectProperty(&object3); - QCOMPARE(expr.changed, true); - expr.changed = false; - QCOMPARE(expr.value(), QVariant("Cat")); - - object1.setObjectProperty(0); - QCOMPARE(expr.changed, true); - expr.changed = false; - QCOMPARE(expr.value(), QVariant()); - - object1.setObjectProperty(&object3); - QCOMPARE(expr.changed, true); - expr.changed = false; - QCOMPARE(expr.value(), QVariant("Cat")); - - object3.setStringProperty("Donkey"); - QCOMPARE(expr.changed, true); - expr.changed = false; - QCOMPARE(expr.value(), QVariant("Donkey")); - } -} - -void tst_qmlecmascript::deferredProperties() -{ - QmlComponent component(&engine, TEST_FILE("deferredProperties.qml")); - MyDeferredObject *object = - qobject_cast<MyDeferredObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->value(), 0); - QVERIFY(object->objectProperty() == 0); - QVERIFY(object->objectProperty2() != 0); - qmlExecuteDeferred(object); - QCOMPARE(object->value(), 10); - QVERIFY(object->objectProperty() != 0); - MyQmlObject *qmlObject = - qobject_cast<MyQmlObject *>(object->objectProperty()); - QVERIFY(qmlObject != 0); - QCOMPARE(qmlObject->value(), 10); - object->setValue(19); - QCOMPARE(qmlObject->value(), 19); -} - -void tst_qmlecmascript::extensionObjects() -{ - QmlComponent component(&engine, TEST_FILE("extensionObjects.qml")); - MyExtendedObject *object = - qobject_cast<MyExtendedObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->baseProperty(), 13); - QCOMPARE(object->coreProperty(), 9); - - object->setProperty("extendedProperty", QVariant(11)); - object->setProperty("baseExtendedProperty", QVariant(92)); - QCOMPARE(object->coreProperty(), 11); - QCOMPARE(object->baseProperty(), 92); -} - -void tst_qmlecmascript::attachedProperties() -{ - QmlComponent component(&engine, TEST_FILE("attachedProperty.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("a").toInt(), 19); - QCOMPARE(object->property("b").toInt(), 19); - QCOMPARE(object->property("c").toInt(), 19); - QCOMPARE(object->property("d").toInt(), 19); - - // ### Need to test attached property assignment -} - -void tst_qmlecmascript::enums() -{ - // Existant enums - { - QmlComponent component(&engine, TEST_FILE("enums.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("a").toInt(), 0); - QCOMPARE(object->property("b").toInt(), 1); - QCOMPARE(object->property("c").toInt(), 2); - QCOMPARE(object->property("d").toInt(), 3); - QCOMPARE(object->property("e").toInt(), 0); - QCOMPARE(object->property("f").toInt(), 1); - QCOMPARE(object->property("g").toInt(), 2); - QCOMPARE(object->property("h").toInt(), 3); - QCOMPARE(object->property("i").toInt(), 19); - QCOMPARE(object->property("j").toInt(), 19); - } - // Non-existent enums - { - QmlComponent component(&engine, TEST_FILE("enums.2.qml")); - - QString warning1 = component.url().toString() + ":5: Unable to assign [undefined] to int"; - QString warning2 = component.url().toString() + ":6: Unable to assign [undefined] to int"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("a").toInt(), 0); - QCOMPARE(object->property("b").toInt(), 0); - } -} - -void tst_qmlecmascript::valueTypeFunctions() -{ - QmlComponent component(&engine, TEST_FILE("valueTypeFunctions.qml")); - MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->rectProperty(), QRect(0,0,100,100)); - QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5)); -} - -/* -Tests that writing a constant to a property with a binding on it disables the -binding. -*/ -void tst_qmlecmascript::constantsOverrideBindings() -{ - // From ECMAScript - { - QmlComponent component(&engine, TEST_FILE("constantsOverrideBindings.1.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("c2").toInt(), 0); - object->setProperty("c1", QVariant(9)); - QCOMPARE(object->property("c2").toInt(), 9); - - emit object->basicSignal(); - - QCOMPARE(object->property("c2").toInt(), 13); - object->setProperty("c1", QVariant(8)); - QCOMPARE(object->property("c2").toInt(), 13); - } - - // During construction - { - QmlComponent component(&engine, TEST_FILE("constantsOverrideBindings.2.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("c1").toInt(), 0); - QCOMPARE(object->property("c2").toInt(), 10); - object->setProperty("c1", QVariant(9)); - QCOMPARE(object->property("c1").toInt(), 9); - QCOMPARE(object->property("c2").toInt(), 10); - } - -#if 0 - // From C++ - { - QmlComponent component(&engine, TEST_FILE("constantsOverrideBindings.3.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("c2").toInt(), 0); - object->setProperty("c1", QVariant(9)); - QCOMPARE(object->property("c2").toInt(), 9); - - object->setProperty("c2", QVariant(13)); - QCOMPARE(object->property("c2").toInt(), 13); - object->setProperty("c1", QVariant(7)); - QCOMPARE(object->property("c1").toInt(), 7); - QCOMPARE(object->property("c2").toInt(), 13); - } -#endif -} - -/* -Tests that assigning a binding to a property that already has a binding causes -the original binding to be disabled. -*/ -void tst_qmlecmascript::outerBindingOverridesInnerBinding() -{ - QmlComponent component(&engine, - TEST_FILE("outerBindingOverridesInnerBinding.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("c1").toInt(), 0); - QCOMPARE(object->property("c2").toInt(), 0); - QCOMPARE(object->property("c3").toInt(), 0); - - object->setProperty("c1", QVariant(9)); - QCOMPARE(object->property("c1").toInt(), 9); - QCOMPARE(object->property("c2").toInt(), 0); - QCOMPARE(object->property("c3").toInt(), 0); - - object->setProperty("c3", QVariant(8)); - QCOMPARE(object->property("c1").toInt(), 9); - QCOMPARE(object->property("c2").toInt(), 8); - QCOMPARE(object->property("c3").toInt(), 8); -} - -/* -Access a non-existent attached object. - -Tests for a regression where this used to crash. -*/ -void tst_qmlecmascript::nonExistantAttachedObject() -{ - QmlComponent component(&engine, TEST_FILE("nonExistantAttachedObject.qml")); - - QString warning = component.url().toString() + ":4: Unable to assign [undefined] to QString"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); - - QObject *object = component.create(); - QVERIFY(object != 0); -} - -void tst_qmlecmascript::scope() -{ - { - QmlComponent component(&engine, TEST_FILE("scope.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), 1); - QCOMPARE(object->property("test2").toInt(), 2); - QCOMPARE(object->property("test3").toString(), QString("1Test")); - QCOMPARE(object->property("test4").toString(), QString("2Test")); - QCOMPARE(object->property("test5").toInt(), 1); - QCOMPARE(object->property("test6").toInt(), 1); - QCOMPARE(object->property("test7").toInt(), 2); - QCOMPARE(object->property("test8").toInt(), 2); - QCOMPARE(object->property("test9").toInt(), 1); - QCOMPARE(object->property("test10").toInt(), 3); - } - - { - QmlComponent component(&engine, TEST_FILE("scope.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), 19); - QCOMPARE(object->property("test2").toInt(), 19); - QCOMPARE(object->property("test3").toInt(), 11); - QCOMPARE(object->property("test4").toInt(), 11); - QCOMPARE(object->property("test5").toInt(), 24); - QCOMPARE(object->property("test6").toInt(), 24); - } -} - -/* -Tests that "any" type passes through a synthesized signal parameter. This -is essentially a test of QmlMetaType::copy() -*/ -void tst_qmlecmascript::signalParameterTypes() -{ - QmlComponent component(&engine, TEST_FILE("signalParameterTypes.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - emit object->basicSignal(); - - QCOMPARE(object->property("intProperty").toInt(), 10); - QCOMPARE(object->property("realProperty").toReal(), 19.2); - QVERIFY(object->property("colorProperty").value<QColor>() == QColor(255, 255, 0, 255)); - QVERIFY(object->property("variantProperty") == QVariant::fromValue(QColor(255, 0, 255, 255))); -} - -/* -Test that two JS objects for the same QObject compare as equal. -*/ -void tst_qmlecmascript::objectsCompareAsEqual() -{ - QmlComponent component(&engine, TEST_FILE("objectsCompareAsEqual.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); - QCOMPARE(object->property("test4").toBool(), true); - QCOMPARE(object->property("test5").toBool(), true); -} - -/* -Confirm bindings and alias properties can coexist. - -Tests for a regression where the binding would not reevaluate. -*/ -void tst_qmlecmascript::aliasPropertyAndBinding() -{ - QmlComponent component(&engine, TEST_FILE("aliasPropertyAndBinding.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("c2").toInt(), 3); - QCOMPARE(object->property("c3").toInt(), 3); - - object->setProperty("c2", QVariant(19)); - - QCOMPARE(object->property("c2").toInt(), 19); - QCOMPARE(object->property("c3").toInt(), 19); -} - -/* -Tests that only methods of Script {} blocks are exposed. -*/ -void tst_qmlecmascript::scriptAccess() -{ - QmlComponent component(&engine, TEST_FILE("scriptAccess.qml")); - - QString warning = component.url().toString() + ":16: Unable to assign [undefined] to int"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), 10); - QCOMPARE(object->property("test2").toInt(), 19); - QCOMPARE(object->property("test3").toInt(), 0); -} - -void tst_qmlecmascript::dynamicCreation_data() -{ - QTest::addColumn<QString>("method"); - QTest::addColumn<QString>("createdName"); - - QTest::newRow("One") << "createOne" << "objectOne"; - QTest::newRow("Two") << "createTwo" << "objectTwo"; - QTest::newRow("Three") << "createThree" << "objectThree"; -} - -/* -Test using createQmlObject to dynamically generate an item -Also using createComponent is tested. -*/ -void tst_qmlecmascript::dynamicCreation() -{ - QFETCH(QString, method); - QFETCH(QString, createdName); - - QmlComponent component(&engine, TEST_FILE("dynamicCreation.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - - QMetaObject::invokeMethod(object, method.toUtf8()); - QObject *created = object->objectProperty(); - QVERIFY(created); - QCOMPARE(created->objectName(), createdName); -} - -/* - Tests the destroy function -*/ -void tst_qmlecmascript::dynamicDestruction() -{ - QmlComponent component(&engine, TEST_FILE("dynamicDeletion.qml")); - QmlGuard<MyQmlObject> object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QmlGuard<QObject> createdQmlObject = 0; - - QMetaObject::invokeMethod(object, "create"); - createdQmlObject = object->objectProperty(); - QVERIFY(createdQmlObject); - QCOMPARE(createdQmlObject->objectName(), QString("emptyObject")); - - QMetaObject::invokeMethod(object, "killOther"); - QVERIFY(createdQmlObject); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); - QVERIFY(createdQmlObject); - for (int ii = 0; createdQmlObject && ii < 50; ++ii) { // After 5 seconds we should give up - if (createdQmlObject) { - QTest::qWait(100); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); - } - } - QVERIFY(!createdQmlObject); - - QMetaObject::invokeMethod(object, "killMe"); - QVERIFY(object); - QTest::qWait(0); - QCoreApplication::instance()->processEvents(QEventLoop::DeferredDeletion); - QVERIFY(!object); -} - -/* - tests that id.toString() works -*/ -void tst_qmlecmascript::objectToString() -{ - QmlComponent component(&engine, TEST_FILE("qmlToString.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QMetaObject::invokeMethod(object, "testToString"); - QVERIFY(object->stringProperty().startsWith("MyQmlObject_QML_")); - QVERIFY(object->stringProperty().endsWith(", \"objName\")")); -} - -/* -Tests bindings that indirectly cause their own deletion work. - -This test is best run under valgrind to ensure no invalid memory access occur. -*/ -void tst_qmlecmascript::selfDeletingBinding() -{ - { - QmlComponent component(&engine, TEST_FILE("selfDeletingBinding.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - object->setProperty("triggerDelete", true); - } - - { - QmlComponent component(&engine, TEST_FILE("selfDeletingBinding.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - object->setProperty("triggerDelete", true); - } -} - -/* -Test that extended object properties can be accessed. - -This test a regression where this used to crash. The issue was specificially -for extended objects that did not include a synthesized meta object (so non-root -and no synthesiszed properties). -*/ -void tst_qmlecmascript::extendedObjectPropertyLookup() -{ - QmlComponent component(&engine, TEST_FILE("extendedObjectPropertyLookup.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -/* -Test file/lineNumbers for binding/Script errors. -*/ -void tst_qmlecmascript::scriptErrors() -{ - QmlComponent component(&engine, TEST_FILE("scriptErrors.qml")); - QString url = component.url().toString(); - - QString warning1 = url.left(url.length() - 3) + "js:2: Error: Invalid write to global property \"a\""; - QString warning2 = url + ":7: TypeError: Result of expression 'a' [undefined] is not an object."; - QString warning3 = url + ":5: Error: Invalid write to global property \"a\""; - QString warning4 = url + ":12: TypeError: Result of expression 'a' [undefined] is not an object."; - QString warning5 = url + ":10: TypeError: Result of expression 'a' [undefined] is not an object."; - QString warning6 = url + ":9: Unable to assign [undefined] to int"; - QString warning7 = url + ":14: Error: Cannot assign to read-only property \"trueProperty\""; - QString warning8 = url + ":15: Error: Cannot assign to non-existent property \"fakeProperty\""; - - QTest::ignoreMessage(QtWarningMsg, warning1.toLatin1().constData()); - QTest::ignoreMessage(QtWarningMsg, warning2.toLatin1().constData()); - QTest::ignoreMessage(QtWarningMsg, warning3.toLatin1().constData()); - QTest::ignoreMessage(QtWarningMsg, warning5.toLatin1().constData()); - QTest::ignoreMessage(QtWarningMsg, warning6.toLatin1().constData()); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - - QTest::ignoreMessage(QtWarningMsg, warning4.toLatin1().constData()); - emit object->basicSignal(); - - QTest::ignoreMessage(QtWarningMsg, warning7.toLatin1().constData()); - emit object->anotherBasicSignal(); - - QTest::ignoreMessage(QtWarningMsg, warning8.toLatin1().constData()); - emit object->thirdBasicSignal(); -} - -/* -Test bindings still work when the reeval is triggered from within -a signal script. -*/ -void tst_qmlecmascript::signalTriggeredBindings() -{ - QmlComponent component(&engine, TEST_FILE("signalTriggeredBindings.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("base").toReal(), 50.); - QCOMPARE(object->property("test1").toReal(), 50.); - QCOMPARE(object->property("test2").toReal(), 50.); - - object->basicSignal(); - - QCOMPARE(object->property("base").toReal(), 200.); - QCOMPARE(object->property("test1").toReal(), 200.); - QCOMPARE(object->property("test2").toReal(), 200.); - - object->argumentSignal(10, QString(), 10); - - QCOMPARE(object->property("base").toReal(), 400.); - QCOMPARE(object->property("test1").toReal(), 400.); - QCOMPARE(object->property("test2").toReal(), 400.); -} - -/* -Test that list properties can be iterated from ECMAScript -*/ -void tst_qmlecmascript::listProperties() -{ - QmlComponent component(&engine, TEST_FILE("listProperties.qml")); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), 21); - QCOMPARE(object->property("test2").toInt(), 2); - QCOMPARE(object->property("test3").toBool(), true); - QCOMPARE(object->property("test4").toBool(), true); -} - -void tst_qmlecmascript::exceptionClearsOnReeval() -{ - QmlComponent component(&engine, TEST_FILE("exceptionClearsOnReeval.qml")); - QString url = component.url().toString(); - - QString warning = url + ":4: TypeError: Result of expression 'objectProperty.objectProperty' [undefined] is not an object."; - - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), false); - - MyQmlObject object2; - MyQmlObject object3; - object2.setObjectProperty(&object3); - object->setObjectProperty(&object2); - - QCOMPARE(object->property("test").toBool(), true); -} - -void tst_qmlecmascript::exceptionSlotProducesWarning() -{ - QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning.qml")); - QString url = component.url().toString(); - - QString warning = component.url().toString() + ":6: Error: JS exception"; - - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); -} - -void tst_qmlecmascript::exceptionBindingProducesWarning() -{ - QmlComponent component(&engine, TEST_FILE("exceptionProducesWarning2.qml")); - QString url = component.url().toString(); - - QString warning = component.url().toString() + ":5: Error: JS exception"; - - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1().constData()); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); -} - -static int transientErrorsMsgCount = 0; -static void transientErrorsMsgHandler(QtMsgType, const char *) -{ - ++transientErrorsMsgCount; -} - -// Check that transient binding errors are not displayed -void tst_qmlecmascript::transientErrors() -{ - QmlComponent component(&engine, TEST_FILE("transientErrors.qml")); - - transientErrorsMsgCount = 0; - QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); - - QObject *object = component.create(); - QVERIFY(object != 0); - - qInstallMsgHandler(old); - - QCOMPARE(transientErrorsMsgCount, 0); -} - -// Check that errors during shutdown are minimized -void tst_qmlecmascript::shutdownErrors() -{ - QmlComponent component(&engine, TEST_FILE("shutdownErrors.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - transientErrorsMsgCount = 0; - QtMsgHandler old = qInstallMsgHandler(transientErrorsMsgHandler); - - delete object; - - qInstallMsgHandler(old); - QCOMPARE(transientErrorsMsgCount, 0); -} - -// Check that Script::source property works as expected -void tst_qmlecmascript::externalScript() -{ - { - QmlComponent component(&engine, TEST_FILE("externalScript.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 92); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("externalScript.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 92); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("externalScript.3.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 92); - QCOMPARE(object->property("test2").toInt(), 92); - QCOMPARE(object->property("test3").toBool(), false); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("externalScript.4.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 92); - QCOMPARE(object->property("test2").toBool(), true); - - delete object; - } -} - -void tst_qmlecmascript::compositePropertyType() -{ - QmlComponent component(&engine, TEST_FILE("compositePropertyType.qml")); - QTest::ignoreMessage(QtDebugMsg, "hello world"); - QObject *object = qobject_cast<QObject *>(component.create()); - delete object; -} - -// QTBUG-5759 -void tst_qmlecmascript::jsObject() -{ - QmlComponent component(&engine, TEST_FILE("jsObject.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 92); - - delete object; -} - -void tst_qmlecmascript::undefinedResetsProperty() -{ - { - QmlComponent component(&engine, TEST_FILE("undefinedResetsProperty.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("resettableProperty").toInt(), 92); - - object->setProperty("setUndefined", true); - - QCOMPARE(object->property("resettableProperty").toInt(), 13); - - object->setProperty("setUndefined", false); - - QCOMPARE(object->property("resettableProperty").toInt(), 92); - - delete object; - } - { - QmlComponent component(&engine, TEST_FILE("undefinedResetsProperty.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("resettableProperty").toInt(), 19); - - QMetaObject::invokeMethod(object, "doReset"); - - QCOMPARE(object->property("resettableProperty").toInt(), 13); - - delete object; - } -} - -// QTBUG-6781 -void tst_qmlecmascript::bug1() -{ - QmlComponent component(&engine, TEST_FILE("bug.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 14); - - object->setProperty("a", 11); - - QCOMPARE(object->property("test").toInt(), 3); - - object->setProperty("b", true); - - QCOMPARE(object->property("test").toInt(), 9); - - delete object; -} - -void tst_qmlecmascript::callQtInvokables() -{ - MyInvokableObject o; - - QmlEngine qmlengine; - QmlEnginePrivate *ep = QmlEnginePrivate::get(&qmlengine); - QScriptEngine *engine = &ep->scriptEngine; - ep->globalClass->explicitSetProperty("object", ep->objectClass->newQObject(&o)); - - // Non-existent methods - o.reset(); - QCOMPARE(engine->evaluate("object.method_nonexistent()").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_nonexistent(10, 11)").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - // Insufficient arguments - o.reset(); - QCOMPARE(engine->evaluate("object.method_int()").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intint(10)").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - // Excessive arguments - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(10, 11)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(10)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intint(10, 11, 12)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 9); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(10)); - QCOMPARE(o.actuals().at(1), QVariant(11)); - - // Test return types - o.reset(); - QCOMPARE(engine->evaluate("object.method_NoArgs()").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 0); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QVERIFY(engine->evaluate("object.method_NoArgs_int()").strictlyEquals(QScriptValue(engine, 6))); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 1); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QVERIFY(engine->evaluate("object.method_NoArgs_real()").strictlyEquals(QScriptValue(engine, 19.7))); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 2); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - { - QScriptValue ret = engine->evaluate("object.method_NoArgs_QPointF()"); - QVERIFY(ret.isVariant()); - QCOMPARE(ret.toVariant(), QVariant(QPointF(123, 4.5))); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 3); - QCOMPARE(o.actuals().count(), 0); - } - - o.reset(); - { - QScriptValue ret = engine->evaluate("object.method_NoArgs_QObject()"); - QVERIFY(ret.isQObject()); - QCOMPARE(ret.toQObject(), (QObject *)&o); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 4); - QCOMPARE(o.actuals().count(), 0); - } - - o.reset(); - QCOMPARE(engine->evaluate("object.method_NoArgs_unknown()").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 5); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - { - QScriptValue ret = engine->evaluate("object.method_NoArgs_QScriptValue()"); - QVERIFY(ret.isString()); - QCOMPARE(ret.toString(), QString("Hello world")); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 6); - QCOMPARE(o.actuals().count(), 0); - } - - o.reset(); - QVERIFY(engine->evaluate("object.method_NoArgs_QVariant()").strictlyEquals(QScriptValue(engine, "QML rocks"))); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 7); - QCOMPARE(o.actuals().count(), 0); - - // Test arg types - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(94)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(94)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(\"94\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(94)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(\"not a number\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_int(object)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 8); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intint(122, 9)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 9); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(122)); - QCOMPARE(o.actuals().at(1), QVariant(9)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(94.3)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(94.3)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(\"94.3\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(94.3)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(\"not a number\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_real(object)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 10); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qIsNaN(o.actuals().at(0).toDouble())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QString(\"Hello world\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 11); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant("Hello world")); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QString(19)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 11); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant("19")); - - o.reset(); - { - QString expected = "MyInvokableObject(0x" + QString::number((intptr_t)&o, 16) + ")"; - QCOMPARE(engine->evaluate("object.method_QString(object)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 11); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(expected)); - } - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QString(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 11); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QString())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QString(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 11); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QString())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(0)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(object)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF())); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPointF())").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF(99.3, -10.2))); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QPointF(object.method_get_QPoint())").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 12); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), QVariant(QPointF(9, 12))); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QObject(0)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 13); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QObject(\"Hello world\")").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 13); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QObject(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 13); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QObject(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 13); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)0)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QObject(object)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 13); - QCOMPARE(o.actuals().count(), 1); - QCOMPARE(o.actuals().at(0), qVariantFromValue((QObject *)&o)); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QScriptValue(null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 14); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isNull()); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QScriptValue(undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 14); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isUndefined()); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QScriptValue(19)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 14); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).strictlyEquals(QScriptValue(engine, 19))); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_QScriptValue([19, 20])").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 14); - QCOMPARE(o.actuals().count(), 1); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(0)).isArray()); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intQScriptValue(4, null)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 15); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(4)); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isNull()); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intQScriptValue(8, undefined)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 15); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(8)); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isUndefined()); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intQScriptValue(3, 19)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 15); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(3)); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).strictlyEquals(QScriptValue(engine, 19))); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_intQScriptValue(44, [19, 20])").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 15); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(44)); - QVERIFY(qvariant_cast<QScriptValue>(o.actuals().at(1)).isArray()); - - // Test overloads - QML will always invoke the *last* method - o.reset(); - QCOMPARE(engine->evaluate("object.method_overload()").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_overload(10)").isError(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), -1); - QCOMPARE(o.actuals().count(), 0); - - o.reset(); - QCOMPARE(engine->evaluate("object.method_overload(10, 11)").isUndefined(), true); - QCOMPARE(o.error(), false); - QCOMPARE(o.invoked(), 17); - QCOMPARE(o.actuals().count(), 2); - QCOMPARE(o.actuals().at(0), QVariant(10)); - QCOMPARE(o.actuals().at(1), QVariant(11)); -} - -// QTBUG-5675 -void tst_qmlecmascript::listToVariant() -{ - QmlComponent component(&engine, TEST_FILE("listToVariant.qml")); - - MyQmlContainer container; - - QmlContext context(engine.rootContext()); - context.addDefaultObject(&container); - - QObject *object = component.create(&context); - QVERIFY(object != 0); - - QVariant v = object->property("test"); - QCOMPARE(v.userType(), qMetaTypeId<QmlListReference>()); - QVERIFY(qvariant_cast<QmlListReference>(v).object() == &container); - - delete object; -} - -// QTBUG-7957 -void tst_qmlecmascript::multiEngineObject() -{ - MyQmlObject obj; - obj.setStringProperty("Howdy planet"); - - QmlEngine e1; - e1.rootContext()->setContextProperty("thing", &obj); - QmlComponent c1(&e1, TEST_FILE("multiEngineObject.qml")); - - QmlEngine e2; - e2.rootContext()->setContextProperty("thing", &obj); - QmlComponent c2(&e2, TEST_FILE("multiEngineObject.qml")); - - QObject *o1 = c1.create(); - QObject *o2 = c2.create(); - - QCOMPARE(o1->property("test").toString(), QString("Howdy planet")); - QCOMPARE(o2->property("test").toString(), QString("Howdy planet")); - - delete o2; - delete o1; -} - -// Test that references to QObjects are cleanup when the object is destroyed -void tst_qmlecmascript::deletedObject() -{ - QmlComponent component(&engine, TEST_FILE("deletedObject.qml")); - - QObject *object = component.create(); - - QCOMPARE(object->property("test1").toBool(), true); - QCOMPARE(object->property("test2").toBool(), true); - QCOMPARE(object->property("test3").toBool(), true); - QEXPECT_FAIL("", "QTBUG-8077", Continue); - QCOMPARE(object->property("test4").toBool(), true); - - delete object; -} - -QTEST_MAIN(tst_qmlecmascript) - -#include "tst_qmlecmascript.moc" diff --git a/tests/auto/declarative/qmlengine/qmlengine.pro b/tests/auto/declarative/qmlengine/qmlengine.pro deleted file mode 100644 index 1a0e5f4..0000000 --- a/tests/auto/declarative/qmlengine/qmlengine.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative network -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlengine.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp deleted file mode 100644 index 6504d03..0000000 --- a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp +++ /dev/null @@ -1,240 +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 <qtest.h> -#include <QmlEngine> -#include <QmlContext> -#include <QNetworkAccessManager> -#include <QPointer> -#include <QDir> -#include <QDesktopServices> -#include <QDebug> -#include <QmlComponent> -#include <QmlNetworkAccessManagerFactory> - -class tst_qmlengine : public QObject -{ - Q_OBJECT -public: - tst_qmlengine() {} - -private slots: - void rootContext(); - void networkAccessManager(); - void baseUrl(); - void contextForObject(); - void offlineStoragePath(); - void clearComponentCache(); -}; - -void tst_qmlengine::rootContext() -{ - QmlEngine engine; - - QVERIFY(engine.rootContext()); - - QCOMPARE(engine.rootContext()->engine(), &engine); - QVERIFY(engine.rootContext()->parentContext() == 0); -} - -class NetworkAccessManagerFactory : public QmlNetworkAccessManagerFactory -{ -public: - NetworkAccessManagerFactory() : manager(0) {} - - QNetworkAccessManager *create(QObject *parent) { - manager = new QNetworkAccessManager(parent); - return manager; - } - - QNetworkAccessManager *manager; -}; - -void tst_qmlengine::networkAccessManager() -{ - QmlEngine *engine = new QmlEngine; - - // Test QmlEngine created manager - QPointer<QNetworkAccessManager> manager = engine->networkAccessManager(); - QVERIFY(manager != 0); - delete engine; - - // Test factory created manager - engine = new QmlEngine; - NetworkAccessManagerFactory factory; - engine->setNetworkAccessManagerFactory(&factory); - QVERIFY(engine->networkAccessManager() == factory.manager); - delete engine; -} - -void tst_qmlengine::baseUrl() -{ - QmlEngine engine; - - QUrl cwd = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()); - - QCOMPARE(engine.baseUrl(), cwd); - QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml"))); - - QDir dir = QDir::current(); - dir.cdUp(); - QVERIFY(dir != QDir::current()); - QDir::setCurrent(dir.path()); - QVERIFY(QDir::current() == dir); - - QUrl cwd2 = QUrl::fromLocalFile(QDir::currentPath() + QDir::separator()); - QCOMPARE(engine.baseUrl(), cwd2); - QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd2.resolved(QUrl("main.qml"))); - - engine.setBaseUrl(cwd); - QCOMPARE(engine.baseUrl(), cwd); - QCOMPARE(engine.rootContext()->resolvedUrl(QUrl("main.qml")), cwd.resolved(QUrl("main.qml"))); -} - -void tst_qmlengine::contextForObject() -{ - QmlEngine *engine = new QmlEngine; - - // Test null-object - QVERIFY(QmlEngine::contextForObject(0) == 0); - - // Test an object with no context - QObject object; - QVERIFY(QmlEngine::contextForObject(&object) == 0); - - // Test setting null-object - QmlEngine::setContextForObject(0, engine->rootContext()); - - // Test setting null-context - QmlEngine::setContextForObject(&object, 0); - - // Test setting context - QmlEngine::setContextForObject(&object, engine->rootContext()); - QVERIFY(QmlEngine::contextForObject(&object) == engine->rootContext()); - - QmlContext context(engine->rootContext()); - - // Try changing context - QTest::ignoreMessage(QtWarningMsg, "QmlEngine::setContextForObject(): Object already has a QmlContext"); - QmlEngine::setContextForObject(&object, &context); - QVERIFY(QmlEngine::contextForObject(&object) == engine->rootContext()); - - // Delete context - delete engine; engine = 0; - QVERIFY(QmlEngine::contextForObject(&object) == 0); -} - -void tst_qmlengine::offlineStoragePath() -{ - // Without these set, QDesktopServices::storageLocation returns - // strings with extra "//" at the end. We set them to ignore this problem. - qApp->setApplicationName("tst_qmlengine"); - qApp->setOrganizationName("Nokia"); - qApp->setOrganizationDomain("nokia.com"); - - QmlEngine engine; - - QDir dir(QDesktopServices::storageLocation(QDesktopServices::DataLocation)); - dir.mkpath("QML"); - dir.cd("QML"); - dir.mkpath("OfflineStorage"); - dir.cd("OfflineStorage"); - - QCOMPARE(QDir::fromNativeSeparators(engine.offlineStoragePath()), dir.path()); - - engine.setOfflineStoragePath(QDir::homePath()); - QCOMPARE(engine.offlineStoragePath(), QDir::homePath()); -} - -void tst_qmlengine::clearComponentCache() -{ - QmlEngine engine; - - // Create original qml file - { - QFile file("temp.qml"); - QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 10\n}\n"); - file.close(); - } - - // Test "test" property - { - QmlComponent component(&engine, "temp.qml"); - QObject *obj = component.create(); - QVERIFY(obj != 0); - QCOMPARE(obj->property("test").toInt(), 10); - delete obj; - } - - // Modify qml file - { - QFile file("temp.qml"); - QVERIFY(file.open(QIODevice::WriteOnly)); - file.write("import Qt 4.6\nQtObject {\nproperty int test: 11\n}\n"); - file.close(); - } - - // Test cache hit - { - QmlComponent component(&engine, "temp.qml"); - QObject *obj = component.create(); - QVERIFY(obj != 0); - QCOMPARE(obj->property("test").toInt(), 10); - delete obj; - } - - // Clear cache - engine.clearComponentCache(); - - // Test cache refresh - { - QmlComponent component(&engine, "temp.qml"); - QObject *obj = component.create(); - QVERIFY(obj != 0); - QCOMPARE(obj->property("test").toInt(), 11); - delete obj; - } -} - -QTEST_MAIN(tst_qmlengine) - -#include "tst_qmlengine.moc" diff --git a/tests/auto/declarative/qmlerror/qmlerror.pro b/tests/auto/declarative/qmlerror/qmlerror.pro deleted file mode 100644 index fa9b79e..0000000 --- a/tests/auto/declarative/qmlerror/qmlerror.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlerror.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlerror/tst_qmlerror.cpp b/tests/auto/declarative/qmlerror/tst_qmlerror.cpp deleted file mode 100644 index 12dde57..0000000 --- a/tests/auto/declarative/qmlerror/tst_qmlerror.cpp +++ /dev/null @@ -1,242 +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 <qtest.h> -#include <QmlError> -#include <QDebug> - -class tst_qmlerror : public QObject -{ - Q_OBJECT -private slots: - void url(); - void description(); - void line(); - void column(); - void toString(); - - void copy(); - void debug(); -}; - -void tst_qmlerror::url() -{ - QmlError error; - - QCOMPARE(error.url(), QUrl()); - - error.setUrl(QUrl("http://www.nokia.com/main.qml")); - - QCOMPARE(error.url(), QUrl("http://www.nokia.com/main.qml")); - - QmlError error2 = error; - - QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); - - error.setUrl(QUrl("http://qt.nokia.com/main.qml")); - - QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); - QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); -} - -void tst_qmlerror::description() -{ - QmlError error; - - QCOMPARE(error.description(), QString()); - - error.setDescription("An Error"); - - QCOMPARE(error.description(), QString("An Error")); - - QmlError error2 = error; - - QCOMPARE(error2.description(), QString("An Error")); - - error.setDescription("Another Error"); - - QCOMPARE(error.description(), QString("Another Error")); - QCOMPARE(error2.description(), QString("An Error")); -} - -void tst_qmlerror::line() -{ - QmlError error; - - QCOMPARE(error.line(), -1); - - error.setLine(102); - - QCOMPARE(error.line(), 102); - - QmlError error2 = error; - - QCOMPARE(error2.line(), 102); - - error.setLine(4); - - QCOMPARE(error.line(), 4); - QCOMPARE(error2.line(), 102); -} - -void tst_qmlerror::column() -{ - QmlError error; - - QCOMPARE(error.column(), -1); - - error.setColumn(16); - - QCOMPARE(error.column(), 16); - - QmlError error2 = error; - - QCOMPARE(error2.column(), 16); - - error.setColumn(3); - - QCOMPARE(error.column(), 3); - QCOMPARE(error2.column(), 16); -} - -void tst_qmlerror::toString() -{ - { - QmlError error; - error.setUrl(QUrl("http://www.nokia.com/main.qml")); - error.setDescription("An Error"); - error.setLine(92); - error.setColumn(13); - - QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92:13: An Error")); - } - - { - QmlError error; - error.setUrl(QUrl("http://www.nokia.com/main.qml")); - error.setDescription("An Error"); - error.setLine(92); - - QCOMPARE(error.toString(), QString("http://www.nokia.com/main.qml:92: An Error")); - } -} - -void tst_qmlerror::copy() -{ - QmlError error; - error.setUrl(QUrl("http://www.nokia.com/main.qml")); - error.setDescription("An Error"); - error.setLine(92); - error.setColumn(13); - - QmlError error2(error); - QmlError error3; - error3 = error; - - error.setUrl(QUrl("http://qt.nokia.com/main.qml")); - error.setDescription("Another Error"); - error.setLine(2); - error.setColumn(33); - - QCOMPARE(error.url(), QUrl("http://qt.nokia.com/main.qml")); - QCOMPARE(error.description(), QString("Another Error")); - QCOMPARE(error.line(), 2); - QCOMPARE(error.column(), 33); - - QCOMPARE(error2.url(), QUrl("http://www.nokia.com/main.qml")); - QCOMPARE(error2.description(), QString("An Error")); - QCOMPARE(error2.line(), 92); - QCOMPARE(error2.column(), 13); - - QCOMPARE(error3.url(), QUrl("http://www.nokia.com/main.qml")); - QCOMPARE(error3.description(), QString("An Error")); - QCOMPARE(error3.line(), 92); - QCOMPARE(error3.column(), 13); - -} - -void tst_qmlerror::debug() -{ - { - QmlError error; - error.setUrl(QUrl("http://www.nokia.com/main.qml")); - error.setDescription("An Error"); - error.setLine(92); - error.setColumn(13); - - QTest::ignoreMessage(QtWarningMsg, "http://www.nokia.com/main.qml:92:13: An Error "); - qWarning() << error; - } - - { - QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("test.txt"))); - QmlError error; - error.setUrl(url); - error.setDescription("An Error"); - error.setLine(2); - error.setColumn(5); - - QString out = url.toString() + ":2:5: An Error \n Line2 Content \n ^ "; - QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); - - qWarning() << error; - } - - { - QUrl url(QUrl::fromLocalFile(QString(SRCDIR) + "/").resolved(QUrl("foo.txt"))); - QmlError error; - error.setUrl(url); - error.setDescription("An Error"); - error.setLine(2); - error.setColumn(5); - - QString out = url.toString() + ":2:5: An Error "; - QTest::ignoreMessage(QtWarningMsg, qPrintable(out)); - - qWarning() << error; - } -} - - - -QTEST_MAIN(tst_qmlerror) - -#include "tst_qmlerror.moc" diff --git a/tests/auto/declarative/qmlfontloader/qmlfontloader.pro b/tests/auto/declarative/qmlfontloader/qmlfontloader.pro deleted file mode 100644 index bc89639..0000000 --- a/tests/auto/declarative/qmlfontloader/qmlfontloader.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlfontloader.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp b/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp deleted file mode 100644 index 41b5359..0000000 --- a/tests/auto/declarative/qmlfontloader/tst_qmlfontloader.cpp +++ /dev/null @@ -1,156 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlfontloader_p.h> -#include "../../../shared/util.h" - -class tst_qmlfontloader : public QObject - -{ - Q_OBJECT -public: - tst_qmlfontloader(); - -private slots: - void noFont(); - void namedFont(); - void localFont(); - void failLocalFont(); - void webFont(); - void failWebFont(); - -private slots: - -private: - QmlEngine engine; -}; - -tst_qmlfontloader::tst_qmlfontloader() -{ -} - -void tst_qmlfontloader::noFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QCOMPARE(fontObject->name(), QString("")); - QCOMPARE(fontObject->source(), QUrl("")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Null); - - delete fontObject; -} - -void tst_qmlfontloader::namedFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { name: \"Helvetica\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QCOMPARE(fontObject->source(), QUrl("")); - QCOMPARE(fontObject->name(), QString("Helvetica")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Ready); -} - -void tst_qmlfontloader::localFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" SRCDIR "/data/tarzeau_ocr_a.ttf\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("OCRA")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Ready); -} - -void tst_qmlfontloader::failLocalFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" }"; - QTest::ignoreMessage(QtWarningMsg, QString("Cannot load font: QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/dummy.ttf").toString() + "\" ) ").toUtf8().constData()); - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Error); -} - -void tst_qmlfontloader::webFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://www.princexml.com/fonts/steffmann/Starburst.ttf\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("Starburst")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Ready); -} - -void tst_qmlfontloader::failWebFont() -{ - QString componentStr = "import Qt 4.6\nFontLoader { source: \"http://wrong.address.com/Starburst.ttf\" }"; - QTest::ignoreMessage(QtWarningMsg, "Cannot load font: QUrl( \"http://wrong.address.com/Starburst.ttf\" ) "); - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlFontLoader *fontObject = qobject_cast<QmlFontLoader*>(component.create()); - - QVERIFY(fontObject != 0); - QVERIFY(fontObject->source() != QUrl("")); - QTRY_COMPARE(fontObject->name(), QString("")); - QTRY_VERIFY(fontObject->status() == QmlFontLoader::Error); -} - -QTEST_MAIN(tst_qmlfontloader) - -#include "tst_qmlfontloader.moc" diff --git a/tests/auto/declarative/qmlgraphicsanchors/qmlgraphicsanchors.pro b/tests/auto/declarative/qmlgraphicsanchors/qmlgraphicsanchors.pro deleted file mode 100644 index 755de3f..0000000 --- a/tests/auto/declarative/qmlgraphicsanchors/qmlgraphicsanchors.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlgraphicsanchors.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp b/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp deleted file mode 100644 index aa6b56a..0000000 --- a/tests/auto/declarative/qmlgraphicsanchors/tst_qmlgraphicsanchors.cpp +++ /dev/null @@ -1,459 +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 <qtest.h> -#include <QSignalSpy> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <private/qmlgraphicstext_p.h> -#include <QtDeclarative/private/qmlgraphicsanchors_p_p.h> - -Q_DECLARE_METATYPE(QmlGraphicsAnchors::UsedAnchor) -Q_DECLARE_METATYPE(QmlGraphicsAnchorLine::AnchorLine) - - -class tst_qmlgraphicsanchors : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicsanchors() {} - - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &id); - -private slots: - void basicAnchors(); - void loops(); - void illegalSets(); - void illegalSets_data(); - void reset(); - void reset_data(); - void resetConvenience(); - void nullItem(); - void nullItem_data(); - void crash1(); - void centerIn(); - void fill(); - void margins(); -}; - -/* - Find an item with the specified id. -*/ -template<typename T> -T *tst_qmlgraphicsanchors::findItem(QGraphicsObject *parent, const QString &objectName) -{ - const QMetaObject &mo = T::staticMetaObject; - QList<QGraphicsItem *> children = parent->childItems(); - for (int i = 0; i < children.count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(children.at(i)->toGraphicsObject()); - if (item) { - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - return static_cast<T*>(item); - } - item = findItem<T>(item, objectName); - if (item) - return static_cast<T*>(item); - } - } - - return 0; -} - -void tst_qmlgraphicsanchors::basicAnchors() -{ - QmlView *view = new QmlView; - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/anchors.qml")); - - view->execute(); - qApp->processEvents(); - - //sibling horizontal - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect1"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect2"))->x(), 122.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect3"))->x(), 74.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect4"))->x(), 16.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect5"))->x(), 112.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect6"))->x(), 64.0); - - //parent horizontal - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect7"))->x(), 0.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect8"))->x(), 240.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect9"))->x(), 120.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect10"))->x(), -10.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect11"))->x(), 230.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect12"))->x(), 110.0); - - //vertical - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect13"))->y(), 20.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect14"))->y(), 155.0); - - //stretch - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect15"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect15"))->width(), 96.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect16"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect16"))->width(), 192.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect17"))->x(), -70.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect17"))->width(), 192.0); - - //vertical stretch - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect18"))->y(), 20.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect18"))->height(), 40.0); - - //more parent horizontal - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect19"))->x(), 115.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect20"))->x(), 235.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect21"))->x(), -5.0); - - //centerIn - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect22"))->x(), 69.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect22"))->y(), 5.0); - - //margins - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->x(), 31.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->y(), 5.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->width(), 86.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect23"))->height(), 10.0); - - // offsets - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect24"))->x(), 26.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect25"))->y(), 60.0); - QCOMPARE(findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("rect26"))->y(), 5.0); - - //baseline - QmlGraphicsText *text1 = findItem<QmlGraphicsText>(view->rootObject(), QLatin1String("text1")); - QmlGraphicsText *text2 = findItem<QmlGraphicsText>(view->rootObject(), QLatin1String("text2")); - QCOMPARE(text1->y(), text2->y()); - - delete view; -} - -// mostly testing that we don't crash -void tst_qmlgraphicsanchors::loops() -{ - { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop1.qml")); - - QString expect = "QML Text (" + view->source().toString() + ":6:5" + ") Possible anchor loop detected on horizontal anchor."; - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); - qApp->processEvents(); - - delete view; - } - - { - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/loop2.qml")); - - QString expect = "QML Image (" + view->source().toString() + ":8:3" + ") Possible anchor loop detected on horizontal anchor."; - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - view->execute(); - qApp->processEvents(); - - delete view; - } -} - -void tst_qmlgraphicsanchors::illegalSets() -{ - QFETCH(QString, qml); - QFETCH(QString, warning); - - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); - - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" + qml.toUtf8()), QUrl::fromLocalFile("")); - if (!component.isReady()) - qWarning() << "Test errors:" << component.errors(); - QVERIFY(component.isReady()); - QObject *o = component.create(); - delete o; -} - -void tst_qmlgraphicsanchors::illegalSets_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("warning"); - - QTest::newRow("H - too many anchors") - << "Rectangle { id: rect; Rectangle { anchors.left: rect.left; anchors.right: rect.right; anchors.horizontalCenter: rect.horizontalCenter } }" - << "QML Rectangle (file::2:23) Cannot specify left, right, and hcenter anchors."; - - foreach (const QString &side, QStringList() << "left" << "right") { - QTest::newRow("H - anchor to V") - << QString("Rectangle { Rectangle { anchors.%1: parent.top } }").arg(side) - << "QML Rectangle (file::2:13) Cannot anchor a horizontal edge to a vertical edge."; - - QTest::newRow("H - anchor to non parent/sibling") - << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) - << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; - - QTest::newRow("H - anchor to self") - << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) - << "QML Rectangle (file::2:1) Cannot anchor item to self."; - } - - - QTest::newRow("V - too many anchors") - << "Rectangle { id: rect; Rectangle { anchors.top: rect.top; anchors.bottom: rect.bottom; anchors.verticalCenter: rect.verticalCenter } }" - << "QML Rectangle (file::2:23) Cannot specify top, bottom, and vcenter anchors."; - - QTest::newRow("V - too many anchors with baseline") - << "Rectangle { Text { id: text1; text: \"Hello\" } Text { anchors.baseline: text1.baseline; anchors.top: text1.top; } }" - << "QML Text (file::2:47) Baseline anchor cannot be used in conjunction with top, bottom, or vcenter anchors."; - - foreach (const QString &side, QStringList() << "top" << "bottom" << "baseline") { - - QTest::newRow("V - anchor to H") - << QString("Rectangle { Rectangle { anchors.%1: parent.left } }").arg(side) - << "QML Rectangle (file::2:13) Cannot anchor a vertical edge to a horizontal edge."; - - QTest::newRow("V - anchor to non parent/sibling") - << QString("Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.%1: rect.%1 } }").arg(side) - << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; - - QTest::newRow("V - anchor to self") - << QString("Rectangle { id: rect; anchors.%1: rect.%1 }").arg(side) - << "QML Rectangle (file::2:1) Cannot anchor item to self."; - } - - - QTest::newRow("centerIn - anchor to non parent/sibling") - << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.centerIn: rect} }" - << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; - - - QTest::newRow("fill - anchor to non parent/sibling") - << "Rectangle { Item { Rectangle { id: rect } } Rectangle { anchors.fill: rect} }" - << "QML Rectangle (file::2:45) Cannot anchor to an item that isn't a parent or sibling."; -} - -void tst_qmlgraphicsanchors::reset() -{ - QFETCH(QString, side); - QFETCH(QmlGraphicsAnchorLine::AnchorLine, anchorLine); - QFETCH(QmlGraphicsAnchors::UsedAnchor, usedAnchor); - - QmlGraphicsItem *baseItem = new QmlGraphicsItem; - - QmlGraphicsAnchorLine anchor; - anchor.item = baseItem; - anchor.anchorLine = anchorLine; - - QmlGraphicsItem *item = new QmlGraphicsItem; - - const QMetaObject *meta = item->anchors()->metaObject(); - QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); - - QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); - QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), true); - - QVERIFY(p.reset(item->anchors())); - QCOMPARE(item->anchors()->usedAnchors().testFlag(usedAnchor), false); - - delete item; - delete baseItem; -} - -void tst_qmlgraphicsanchors::reset_data() -{ - QTest::addColumn<QString>("side"); - QTest::addColumn<QmlGraphicsAnchorLine::AnchorLine>("anchorLine"); - QTest::addColumn<QmlGraphicsAnchors::UsedAnchor>("usedAnchor"); - - QTest::newRow("left") << "left" << QmlGraphicsAnchorLine::Left << QmlGraphicsAnchors::HasLeftAnchor; - QTest::newRow("top") << "top" << QmlGraphicsAnchorLine::Top << QmlGraphicsAnchors::HasTopAnchor; - QTest::newRow("right") << "right" << QmlGraphicsAnchorLine::Right << QmlGraphicsAnchors::HasRightAnchor; - QTest::newRow("bottom") << "bottom" << QmlGraphicsAnchorLine::Bottom << QmlGraphicsAnchors::HasBottomAnchor; - - QTest::newRow("hcenter") << "horizontalCenter" << QmlGraphicsAnchorLine::HCenter << QmlGraphicsAnchors::HasHCenterAnchor; - QTest::newRow("vcenter") << "verticalCenter" << QmlGraphicsAnchorLine::VCenter << QmlGraphicsAnchors::HasVCenterAnchor; - QTest::newRow("baseline") << "baseline" << QmlGraphicsAnchorLine::Baseline << QmlGraphicsAnchors::HasBaselineAnchor; -} - -void tst_qmlgraphicsanchors::resetConvenience() -{ - QmlGraphicsItem *baseItem = new QmlGraphicsItem; - QmlGraphicsItem *item = new QmlGraphicsItem; - - //fill - item->anchors()->setFill(baseItem); - QVERIFY(item->anchors()->fill() == baseItem); - item->anchors()->resetFill(); - QVERIFY(item->anchors()->fill() == 0); - - //centerIn - item->anchors()->setCenterIn(baseItem); - QVERIFY(item->anchors()->centerIn() == baseItem); - item->anchors()->resetCenterIn(); - QVERIFY(item->anchors()->centerIn() == 0); - - delete item; - delete baseItem; -} - -void tst_qmlgraphicsanchors::nullItem() -{ - QFETCH(QString, side); - - QmlGraphicsAnchorLine anchor; - QmlGraphicsItem *item = new QmlGraphicsItem; - - const QMetaObject *meta = item->anchors()->metaObject(); - QMetaProperty p = meta->property(meta->indexOfProperty(side.toUtf8().constData())); - - QTest::ignoreMessage(QtWarningMsg, "QML Item (unknown location) Cannot anchor to a null item."); - QVERIFY(p.write(item->anchors(), qVariantFromValue(anchor))); - - delete item; -} - -void tst_qmlgraphicsanchors::nullItem_data() -{ - QTest::addColumn<QString>("side"); - - QTest::newRow("left") << "left"; - QTest::newRow("top") << "top"; - QTest::newRow("right") << "right"; - QTest::newRow("bottom") << "bottom"; - - QTest::newRow("hcenter") << "horizontalCenter"; - QTest::newRow("vcenter") << "verticalCenter"; - QTest::newRow("baseline") << "baseline"; -} - -void tst_qmlgraphicsanchors::crash1() -{ - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/crash1.qml")); - - QString expect = "QML Text (" + view->source().toString() + ":4:5" + ") Possible anchor loop detected on fill."; - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); // XXX ideally, should be one message - view->execute(); - qApp->processEvents(); - - delete view; -} - -void tst_qmlgraphicsanchors::fill() -{ - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/fill.qml")); - - view->execute(); - qApp->processEvents(); - QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler")); - QCOMPARE(rect->x(), 0.0 + 10.0); - QCOMPARE(rect->y(), 0.0 + 30.0); - QCOMPARE(rect->width(), 200.0 - 10.0 - 20.0); - QCOMPARE(rect->height(), 200.0 - 30.0 - 40.0); - //Alter Offsets (QTBUG-6631) - rect->anchors()->setLeftMargin(20.0); - rect->anchors()->setRightMargin(0.0); - rect->anchors()->setBottomMargin(0.0); - rect->anchors()->setTopMargin(10.0); - QCOMPARE(rect->x(), 0.0 + 20.0); - QCOMPARE(rect->y(), 0.0 + 10.0); - QCOMPARE(rect->width(), 200.0 - 20.0); - QCOMPARE(rect->height(), 200.0 - 10.0); - - delete view; -} - -void tst_qmlgraphicsanchors::centerIn() -{ - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/centerin.qml")); - - view->execute(); - qApp->processEvents(); - QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("centered")); - QCOMPARE(rect->x(), 75.0 + 10); - QCOMPARE(rect->y(), 75.0 + 30); - //Alter Offsets (QTBUG-6631) - rect->anchors()->setHorizontalCenterOffset(-20.0); - rect->anchors()->setVerticalCenterOffset(-10.0); - QCOMPARE(rect->x(), 75.0 - 20.0); - QCOMPARE(rect->y(), 75.0 - 10.0); - - delete view; -} - -void tst_qmlgraphicsanchors::margins() -{ - QmlView *view = new QmlView; - - view->setSource(QUrl::fromLocalFile(SRCDIR "/data/margins.qml")); - - view->execute(); - qApp->processEvents(); - QmlGraphicsRectangle* rect = findItem<QmlGraphicsRectangle>(view->rootObject(), QLatin1String("filler")); - QCOMPARE(rect->x(), 5.0); - QCOMPARE(rect->y(), 6.0); - QCOMPARE(rect->width(), 200.0 - 5.0 - 10.0); - QCOMPARE(rect->height(), 200.0 - 6.0 - 10.0); - - rect->anchors()->setTopMargin(0.0); - rect->anchors()->setMargins(20.0); - - QCOMPARE(rect->x(), 5.0); - QCOMPARE(rect->y(), 20.0); - QCOMPARE(rect->width(), 200.0 - 5.0 - 20.0); - QCOMPARE(rect->height(), 200.0 - 20.0 - 20.0); - - delete view; -} - -QTEST_MAIN(tst_qmlgraphicsanchors) - -#include "tst_qmlgraphicsanchors.moc" diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/qmlgraphicsanimatedimage.pro b/tests/auto/declarative/qmlgraphicsanimatedimage/qmlgraphicsanimatedimage.pro deleted file mode 100644 index 877dfab..0000000 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/qmlgraphicsanimatedimage.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative network -HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsanimatedimage.cpp ../shared/testhttpserver.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsanimatedimage/tst_qmlgraphicsanimatedimage.cpp b/tests/auto/declarative/qmlgraphicsanimatedimage/tst_qmlgraphicsanimatedimage.cpp deleted file mode 100644 index 2342f25..0000000 --- a/tests/auto/declarative/qmlgraphicsanimatedimage/tst_qmlgraphicsanimatedimage.cpp +++ /dev/null @@ -1,191 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <private/qmlgraphicsimage_p.h> -#include <private/qmlgraphicsanimatedimage_p.h> - -#include "../shared/testhttpserver.h" - -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - -class tst_qmlgraphicsanimatedimage : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicsanimatedimage() {} - -private slots: - void play(); - void pause(); - void stopped(); - void setFrame(); - void frameCount(); - void remote(); - void remote_data(); - void invalidSource(); -}; - -void tst_qmlgraphicsanimatedimage::play() -{ - QmlEngine engine; - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickman.qml")); - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - QVERIFY(anim->isPlaying()); - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::pause() -{ - QmlEngine engine; - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - QVERIFY(anim->isPlaying()); - QVERIFY(anim->isPaused()); - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::stopped() -{ - QmlEngine engine; - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanstopped.qml")); - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - QVERIFY(!anim->isPlaying()); - QCOMPARE(anim->currentFrame(), 0); - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::setFrame() -{ - QmlEngine engine; - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/stickmanpause.qml")); - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - QVERIFY(anim->isPlaying()); - QCOMPARE(anim->currentFrame(), 2); - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::frameCount() -{ - QmlEngine engine; - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/colors.qml")); - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - QVERIFY(anim->isPlaying()); - QCOMPARE(anim->frameCount(), 3); - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::remote() -{ - QFETCH(QString, fileName); - QFETCH(bool, paused); - - TestHTTPServer server(14445); - QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); - - QmlEngine engine; - QmlComponent component(&engine, QUrl("http://127.0.0.1:14445/" + fileName)); - TRY_WAIT(component.isReady()); - - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - - TRY_WAIT(anim->isPlaying()); - if (paused) { - TRY_WAIT(anim->isPaused()); - QCOMPARE(anim->currentFrame(), 2); - } - - delete anim; -} - -void tst_qmlgraphicsanimatedimage::remote_data() -{ - QTest::addColumn<QString>("fileName"); - QTest::addColumn<bool>("paused"); - - QTest::newRow("playing") << "stickman.qml" << false; - QTest::newRow("paused") << "stickmanpause.qml" << true; -} - -void tst_qmlgraphicsanimatedimage::invalidSource() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData("import Qt 4.6\n AnimatedImage { source: \"no-such-file.gif\" }", QUrl::fromLocalFile("")); - QVERIFY(component.isReady()); - - QTest::ignoreMessage(QtWarningMsg, "Error Reading Animated Image File QUrl( \"file:no-such-file.gif\" ) "); - - QmlGraphicsAnimatedImage *anim = qobject_cast<QmlGraphicsAnimatedImage *>(component.create()); - QVERIFY(anim); - - QVERIFY(!anim->isPlaying()); - QVERIFY(!anim->isPaused()); - QCOMPARE(anim->currentFrame(), 0); - QCOMPARE(anim->frameCount(), 0); -} - -QTEST_MAIN(tst_qmlgraphicsanimatedimage) - -#include "tst_qmlgraphicsanimatedimage.moc" diff --git a/tests/auto/declarative/qmlgraphicsborderimage/qmlgraphicsborderimage.pro b/tests/auto/declarative/qmlgraphicsborderimage/qmlgraphicsborderimage.pro deleted file mode 100644 index 1f606e5..0000000 --- a/tests/auto/declarative/qmlgraphicsborderimage/qmlgraphicsborderimage.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui network -macx:CONFIG -= app_bundle - -HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsborderimage.cpp ../shared/testhttpserver.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp b/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp deleted file mode 100644 index bb978d1..0000000 --- a/tests/auto/declarative/qmlgraphicsborderimage/tst_qmlgraphicsborderimage.cpp +++ /dev/null @@ -1,351 +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 <qtest.h> -#include <QTextDocument> -#include <QTcpServer> -#include <QTcpSocket> -#include <QDir> - -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsborderimage_p.h> -#include <private/qmlgraphicsimagebase_p.h> -#include <private/qmlgraphicsscalegrid_p_p.h> -#include <private/qmlgraphicsloader_p.h> -#include <QtDeclarative/qmlcontext.h> - -#include "../shared/testhttpserver.h" - - -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" - -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 60; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - -class tst_qmlgraphicsborderimage : public QObject - -{ - Q_OBJECT -public: - tst_qmlgraphicsborderimage(); - -private slots: - void noSource(); - void imageSource(); - void imageSource_data(); - void clearSource(); - void resized(); - void smooth(); - void tileModes(); - void sciSource(); - void sciSource_data(); - void invalidSciFile(); - void pendingRemoteRequest(); - void pendingRemoteRequest_data(); - -private: - QmlEngine engine; -}; - -tst_qmlgraphicsborderimage::tst_qmlgraphicsborderimage() -{ -} - -void tst_qmlgraphicsborderimage::noSource() -{ - QString componentStr = "import Qt 4.6\nBorderImage { source: \"\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->source(), QUrl()); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Stretch); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsborderimage::imageSource_data() -{ - QTest::addColumn<QString>("source"); - QTest::addColumn<bool>("remote"); - QTest::addColumn<QString>("error"); - - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << ""; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false - << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; - QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true - << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; -} - -void tst_qmlgraphicsborderimage::imageSource() -{ - QFETCH(QString, source); - QFETCH(bool, remote); - QFETCH(QString, error); - - TestHTTPServer *server = 0; - if (remote) { - server = new TestHTTPServer(SERVER_PORT); - QVERIFY(server->isValid()); - server->serveDirectory(SRCDIR "/data"); - } - - if (!error.isEmpty()) - QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - - if (remote) - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Loading); - - QCOMPARE(obj->source(), remote ? source : QUrl(source)); - - if (error.isEmpty()) { - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Ready); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Stretch); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Stretch); - } else { - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Error); - } - - delete obj; - delete server; -} - -void tst_qmlgraphicsborderimage::clearSource() -{ - QString componentStr = "import Qt 4.6\nBorderImage { source: srcImage }"; - QmlContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QVERIFY(obj->status() == QmlGraphicsBorderImage::Ready); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - - ctxt->setContextProperty("srcImage", ""); - QVERIFY(obj->source().isEmpty()); - QVERIFY(obj->status() == QmlGraphicsBorderImage::Null); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); -} - -void tst_qmlgraphicsborderimage::resized() -{ - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() + "\"; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Stretch); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsborderimage::smooth() -{ - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->smooth(), true); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Stretch); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsborderimage::tileModes() -{ - { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 100; height: 300; horizontalTileMode: BorderImage.Repeat; verticalTileMode: BorderImage.Repeat }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 100.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Repeat); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Repeat); - - delete obj; - } - { - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 150; horizontalTileMode: BorderImage.Round; verticalTileMode: BorderImage.Round }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 150.); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Round); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Round); - - delete obj; - } -} - -void tst_qmlgraphicsborderimage::sciSource() -{ - QFETCH(QString, source); - QFETCH(bool, valid); - - bool remote = source.startsWith("http"); - TestHTTPServer *server = 0; - if (remote) { - server = new TestHTTPServer(SERVER_PORT); - QVERIFY(server->isValid()); - server->serveDirectory(SRCDIR "/data"); - } - - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\"; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - - if (remote) - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Loading); - - QCOMPARE(obj->source(), remote ? source : QUrl(source)); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - - if (valid) { - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Ready); - QCOMPARE(obj->border()->left(), 10); - QCOMPARE(obj->border()->top(), 20); - QCOMPARE(obj->border()->right(), 30); - QCOMPARE(obj->border()->bottom(), 40); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Round); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Repeat); - } else { - TRY_WAIT(obj->status() == QmlGraphicsBorderImage::Error); - } - - delete obj; - delete server; -} - -void tst_qmlgraphicsborderimage::sciSource_data() -{ - QTest::addColumn<QString>("source"); - QTest::addColumn<bool>("valid"); - - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors-round.sci").toString() << true; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.sci").toString() << false; - QTest::newRow("remote") << SERVER_ADDR "/colors-round.sci" << true; - QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.sci" << false; -} - -void tst_qmlgraphicsborderimage::invalidSciFile() -{ - QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Roun" - QTest::ignoreMessage(QtWarningMsg, "Unknown tile rule specified. Using Stretch "); // for "Repea" - - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + QUrl::fromLocalFile(SRCDIR "/data/invalid.sci").toString() +"\"; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->status(), QmlGraphicsImageBase::Error); - QCOMPARE(obj->horizontalTileMode(), QmlGraphicsBorderImage::Stretch); - QCOMPARE(obj->verticalTileMode(), QmlGraphicsBorderImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsborderimage::pendingRemoteRequest() -{ - QFETCH(QString, source); - - QString componentStr = "import Qt 4.6\nBorderImage { source: \"" + source + "\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsBorderImage *obj = qobject_cast<QmlGraphicsBorderImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->status(), QmlGraphicsBorderImage::Loading); - - // verify no crash - // This will cause a delayed "QThread: Destroyed while thread is still running" warning - delete obj; - QTest::qWait(50); -} - -void tst_qmlgraphicsborderimage::pendingRemoteRequest_data() -{ - QTest::addColumn<QString>("source"); - - QTest::newRow("png file") << "http://no-such-qt-server-like-this/none.png"; - QTest::newRow("sci file") << "http://no-such-qt-server-like-this/none.sci"; -} - -QTEST_MAIN(tst_qmlgraphicsborderimage) - -#include "tst_qmlgraphicsborderimage.moc" diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml deleted file mode 100644 index 3e08359..0000000 --- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable02.qml +++ /dev/null @@ -1,14 +0,0 @@ -import Qt 4.6 - -Flickable { - width: 100; height: 100 - viewportWidth: row.width; viewportHeight: row.height - - Row { - id: row - Repeater { - model: 4 - Rectangle { width: 200; height: 300; color: "blue" } - } - } -} diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml deleted file mode 100644 index 3ed173d..0000000 --- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable03.qml +++ /dev/null @@ -1,14 +0,0 @@ -import Qt 4.6 - -Flickable { - width: 100; height: 100 - viewportWidth: column.width; viewportHeight: column.height - - Column { - id: column - Repeater { - model: 4 - Rectangle { width: 200; height: 300; color: "blue" } - } - } -} diff --git a/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml b/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml deleted file mode 100644 index 1425d85..0000000 --- a/tests/auto/declarative/qmlgraphicsflickable/data/flickable04.qml +++ /dev/null @@ -1,16 +0,0 @@ -import Qt 4.6 - -Flickable { - width: 100; height: 100 - viewportWidth: column.width; viewportHeight: column.height - pressDelay: 200; overShoot: false; interactive: false - maximumFlickVelocity: 2000 - - Column { - id: column - Repeater { - model: 4 - Rectangle { width: 200; height: 300; color: "blue" } - } - } -} diff --git a/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro b/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro deleted file mode 100644 index 7c4c959..0000000 --- a/tests/auto/declarative/qmlgraphicsflickable/qmlgraphicsflickable.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsflickable.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp b/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp deleted file mode 100644 index b503571..0000000 --- a/tests/auto/declarative/qmlgraphicsflickable/tst_qmlgraphicsflickable.cpp +++ /dev/null @@ -1,224 +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 <qtest.h> -#include <QtTest/QSignalSpy> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsflickable_p.h> -#include <private/qmlvaluetype_p.h> -#include <math.h> - -class tst_qmlgraphicsflickable : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicsflickable(); - -private slots: - void create(); - void horizontalViewportSize(); - void verticalViewportSize(); - void properties(); - void overShoot(); - void maximumFlickVelocity(); - void flickDeceleration(); - void pressDelay(); - -private: - QmlEngine engine; -}; - -tst_qmlgraphicsflickable::tst_qmlgraphicsflickable() -{ -} - -void tst_qmlgraphicsflickable::create() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable01.qml")); - QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); - - QVERIFY(obj != 0); - QCOMPARE(obj->isAtXBeginning(), true); - QCOMPARE(obj->isAtXEnd(), false); - QCOMPARE(obj->isAtYBeginning(), true); - QCOMPARE(obj->isAtYEnd(), false); - QCOMPARE(obj->viewportX(), 0.); - QCOMPARE(obj->viewportY(), 0.); - - QCOMPARE(obj->horizontalVelocity(), 0.); - QCOMPARE(obj->verticalVelocity(), 0.); - QCOMPARE(obj->reportedVelocitySmoothing(), 100.); - - QCOMPARE(obj->isInteractive(), true); - QCOMPARE(obj->overShoot(), true); - QCOMPARE(obj->pressDelay(), 0); - QCOMPARE(obj->maximumFlickVelocity(), 2000.); - - delete obj; -} - -void tst_qmlgraphicsflickable::horizontalViewportSize() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable02.qml")); - QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); - - QVERIFY(obj != 0); - QCOMPARE(obj->viewportWidth(), 800.); - QCOMPARE(obj->viewportHeight(), 300.); - QCOMPARE(obj->isAtXBeginning(), true); - QCOMPARE(obj->isAtXEnd(), false); - QCOMPARE(obj->isAtYBeginning(), true); - QCOMPARE(obj->isAtYEnd(), false); - - delete obj; -} - -void tst_qmlgraphicsflickable::verticalViewportSize() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable03.qml")); - QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); - - QVERIFY(obj != 0); - QCOMPARE(obj->viewportWidth(), 200.); - QCOMPARE(obj->viewportHeight(), 1200.); - QCOMPARE(obj->isAtXBeginning(), true); - QCOMPARE(obj->isAtXEnd(), false); - QCOMPARE(obj->isAtYBeginning(), true); - QCOMPARE(obj->isAtYEnd(), false); - - delete obj; -} - -void tst_qmlgraphicsflickable::properties() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/flickable04.qml")); - QmlGraphicsFlickable *obj = qobject_cast<QmlGraphicsFlickable*>(c.create()); - - QVERIFY(obj != 0); - QCOMPARE(obj->isInteractive(), false); - QCOMPARE(obj->overShoot(), false); - QCOMPARE(obj->pressDelay(), 200); - QCOMPARE(obj->maximumFlickVelocity(), 2000.); - - delete obj; -} - -void tst_qmlgraphicsflickable::overShoot() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6; Flickable { overShoot: false; }", QUrl::fromLocalFile("")); - QmlGraphicsFlickable *flickable = qobject_cast<QmlGraphicsFlickable*>(component.create()); - QSignalSpy spy(flickable, SIGNAL(overShootChanged())); - - QVERIFY(flickable); - QVERIFY(!flickable->overShoot()); - - flickable->setOverShoot(true); - QVERIFY(flickable->overShoot()); - QCOMPARE(spy.count(),1); - flickable->setOverShoot(true); - QCOMPARE(spy.count(),1); - - flickable->setOverShoot(false); - QVERIFY(!flickable->overShoot()); - QCOMPARE(spy.count(),2); - flickable->setOverShoot(false); - QCOMPARE(spy.count(),2); -} - -void tst_qmlgraphicsflickable::maximumFlickVelocity() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6; Flickable { maximumFlickVelocity: 1.0; }", QUrl::fromLocalFile("")); - QmlGraphicsFlickable *flickable = qobject_cast<QmlGraphicsFlickable*>(component.create()); - QSignalSpy spy(flickable, SIGNAL(maximumFlickVelocityChanged())); - - QVERIFY(flickable); - QCOMPARE(flickable->maximumFlickVelocity(), 1.0); - - flickable->setMaximumFlickVelocity(2.0); - QCOMPARE(flickable->maximumFlickVelocity(), 2.0); - QCOMPARE(spy.count(),1); - flickable->setMaximumFlickVelocity(2.0); - QCOMPARE(spy.count(),1); -} - -void tst_qmlgraphicsflickable::flickDeceleration() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6; Flickable { flickDeceleration: 1.0; }", QUrl::fromLocalFile("")); - QmlGraphicsFlickable *flickable = qobject_cast<QmlGraphicsFlickable*>(component.create()); - QSignalSpy spy(flickable, SIGNAL(flickDecelerationChanged())); - - QVERIFY(flickable); - QCOMPARE(flickable->flickDeceleration(), 1.0); - - flickable->setFlickDeceleration(2.0); - QCOMPARE(flickable->flickDeceleration(), 2.0); - QCOMPARE(spy.count(),1); - flickable->setFlickDeceleration(2.0); - QCOMPARE(spy.count(),1); -} - -void tst_qmlgraphicsflickable::pressDelay() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6; Flickable { pressDelay: 100; }", QUrl::fromLocalFile("")); - QmlGraphicsFlickable *flickable = qobject_cast<QmlGraphicsFlickable*>(component.create()); - QSignalSpy spy(flickable, SIGNAL(pressDelayChanged())); - - QVERIFY(flickable); - QCOMPARE(flickable->pressDelay(), 100); - - flickable->setPressDelay(200); - QCOMPARE(flickable->pressDelay(), 200); - QCOMPARE(spy.count(),1); - flickable->setPressDelay(200); - QCOMPARE(spy.count(),1); -} - -QTEST_MAIN(tst_qmlgraphicsflickable) - -#include "tst_qmlgraphicsflickable.moc" diff --git a/tests/auto/declarative/qmlgraphicsflipable/qmlgraphicsflipable.pro b/tests/auto/declarative/qmlgraphicsflipable/qmlgraphicsflipable.pro deleted file mode 100644 index b046086..0000000 --- a/tests/auto/declarative/qmlgraphicsflipable/qmlgraphicsflipable.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsflipable.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp b/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp deleted file mode 100644 index 24dc2e8..0000000 --- a/tests/auto/declarative/qmlgraphicsflipable/tst_qmlgraphicsflipable.cpp +++ /dev/null @@ -1,113 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsflipable_p.h> -#include <private/qmlvaluetype_p.h> -#include <QFontMetrics> -#include <private/qmlgraphicsrectangle_p.h> -#include <math.h> - -class tst_qmlgraphicsflipable : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicsflipable(); - -private slots: - void create(); - void checkFrontAndBack(); - void setFrontAndBack(); - -private: - QmlEngine engine; -}; - -tst_qmlgraphicsflipable::tst_qmlgraphicsflipable() -{ -} - -void tst_qmlgraphicsflipable::create() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); - QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); - - QVERIFY(obj != 0); - delete obj; -} - -void tst_qmlgraphicsflipable::checkFrontAndBack() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); - QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); - delete obj; -} - -void tst_qmlgraphicsflipable::setFrontAndBack() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/test-flipable.qml")); - QmlGraphicsFlipable *obj = qobject_cast<QmlGraphicsFlipable*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->front() != 0); - QVERIFY(obj->back() != 0); - - QString message = "QML Flipable (" + c.url().toString() + ":3:1) front is a write-once property"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - obj->setFront(new QmlGraphicsRectangle()); - - message = "QML Flipable (" + c.url().toString() + ":3:1) back is a write-once property"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - obj->setBack(new QmlGraphicsRectangle()); - delete obj; -} - -QTEST_MAIN(tst_qmlgraphicsflipable) - -#include "tst_qmlgraphicsflipable.moc" diff --git a/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro b/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro deleted file mode 100644 index 8eae8ae..0000000 --- a/tests/auto/declarative/qmlgraphicsgridview/qmlgraphicsgridview.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsgridview.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp b/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp deleted file mode 100644 index 2520d4a..0000000 --- a/tests/auto/declarative/qmlgraphicsgridview/tst_qmlgraphicsgridview.cpp +++ /dev/null @@ -1,967 +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 <qmlengine.h> -#include <qmlcomponent.h> -#include <QtTest/QtTest> -#include <private/qlistmodelinterface_p.h> -#include <qmlview.h> -#include <private/qmlgraphicsgridview_p.h> -#include <private/qmlgraphicstext_p.h> -#include <qmlcontext.h> -#include <qmlexpression.h> - -class tst_QmlGraphicsGridView : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsGridView(); - -private slots: - void items(); - void changed(); - void inserted(); - void removed(); - void moved(); - void changeFlow(); - void currentIndex(); - void defaultValues(); - void properties(); - void positionViewAtIndex(); - -private: - QmlView *createView(const QString &filename); - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); - template<typename T> - QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); - void dumpTree(QmlGraphicsItem *parent, int depth = 0); -}; - -class TestModel : public QAbstractListModel -{ -public: - enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; - - TestModel(QObject *parent=0) : QAbstractListModel(parent) { - QHash<int, QByteArray> roles; - roles[Name] = "name"; - roles[Number] = "number"; - setRoleNames(roles); - } - - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { - QVariant rv; - if (role == Name) - rv = list.at(index.row()).first; - else if (role == Number) - rv = list.at(index.row()).second; - - return rv; - } - - int count() const { return rowCount(); } - QString name(int index) const { return list.at(index).first; } - QString number(int index) const { return list.at(index).second; } - - void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); - list.append(QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); - list.insert(index, QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); - list.removeAt(index); - emit endRemoveRows(); - } - - void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); - list.move(from, to); - emit endMoveRows(); - } - - void modifyItem(int idx, const QString &name, const QString &number) { - list[idx] = QPair<QString,QString>(name, number); - emit dataChanged(index(idx,0), index(idx,0)); - } - -private: - QList<QPair<QString,QString> > list; -}; - -tst_QmlGraphicsGridView::tst_QmlGraphicsGridView() -{ -} - -void tst_QmlGraphicsGridView::items() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - model.addItem("Billy", "22345"); - model.addItem("Sam", "2945"); - model.addItem("Ben", "04321"); - model.addItem("Jim", "0780"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - QCOMPARE(gridview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - // set an empty model and confirm that items are destroyed - TestModel model2; - ctxt->setContextProperty("testModel", &model2); - - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); - - delete canvas; -} - -void tst_QmlGraphicsGridView::changed() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - model.addItem("Billy", "22345"); - model.addItem("Sam", "2945"); - model.addItem("Ben", "04321"); - model.addItem("Jim", "0780"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsFlickable *gridview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - model.modifyItem(1, "Will", "9876"); - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - delete canvas; -} - -void tst_QmlGraphicsGridView::inserted() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - model.insertItem(1, "Will", "9876"); - - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - // Confirm items positioned correctly - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - QCOMPARE(item->x(), (i%3)*80.0); - QCOMPARE(item->y(), (i/3)*60.0); - } - - model.insertItem(0, "Foo", "1111"); // zero index, and current item - - // let transitions settle. - QTest::qWait(300); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - name = findItem<QmlGraphicsText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); - - QCOMPARE(gridview->currentIndex(), 1); - - // Confirm items positioned correctly - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - for (int i = model.count(); i < 30; ++i) - model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(300); - - gridview->setViewportY(120); - QTest::qWait(300); - - // Insert item outside visible area - model.insertItem(1, "Hello", "1324"); - QTest::qWait(300); - - QVERIFY(gridview->viewportY() == 120); - - delete canvas; -} - -void tst_QmlGraphicsGridView::removed() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - for (int i = 0; i < 40; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - model.removeItem(1); - - // let transitions settle. - QTest::qWait(300); - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - // Remove first item (which is the current item); - model.removeItem(0); - - // let transitions settle. - QTest::qWait(300); - - name = findItem<QmlGraphicsText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - // Remove items not visible - model.removeItem(25); - // let transitions settle. - QTest::qWait(300); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - // Remove items before visible - gridview->setViewportY(120); - QTest::qWait(500); - gridview->setCurrentIndex(10); - - // let transitions settle. - QTest::qWait(300); - - // Setting currentIndex above shouldn't cause view to scroll - QCOMPARE(gridview->viewportY(), 120.0); - - model.removeItem(1); - - // let transitions settle. - QTest::qWait(300); - - // Confirm items positioned correctly - for (int i = 6; i < 18; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - // Remove currentIndex - QmlGraphicsItem *oldCurrent = gridview->currentItem(); - model.removeItem(9); - QTest::qWait(500); - - QCOMPARE(gridview->currentIndex(), 9); - QVERIFY(gridview->currentItem() != oldCurrent); - - gridview->setViewportY(0); - // let transitions settle. - QTest::qWait(300); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - // remove item outside current view. - gridview->setCurrentIndex(32); - QTest::qWait(500); - gridview->setViewportY(240); - - model.removeItem(30); - QVERIFY(gridview->currentIndex() == 31); - - // remove current item beyond visible items. - gridview->setCurrentIndex(20); - QTest::qWait(500); - gridview->setViewportY(0); - model.removeItem(20); - QTest::qWait(500); - - QCOMPARE(gridview->currentIndex(), 20); - QVERIFY(gridview->currentItem() != 0); - - // remove item before current, but visible - gridview->setCurrentIndex(8); - QTest::qWait(500); - gridview->setViewportY(240); - oldCurrent = gridview->currentItem(); - model.removeItem(6); - QTest::qWait(500); - - QCOMPARE(gridview->currentIndex(), 7); - QVERIFY(gridview->currentItem() == oldCurrent); - - delete canvas; -} - -void tst_QmlGraphicsGridView::moved() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - model.moveItem(1, 8); - - // let transitions settle. - QTest::qWait(300); - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - name = findItem<QmlGraphicsText>(viewport, "textName", 8); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(8)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 8); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(8)); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - } - - gridview->setViewportY(120); - - // move outside visible area - model.moveItem(1, 25); - - // let transitions settle. - QTest::qWait(300); - - // Confirm items positioned correctly and indexes correct - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count()-1; - for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); - name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - // move from outside visible into visible - model.moveItem(28, 8); - - // let transitions settle. - QTest::qWait(300); - - // Confirm items positioned correctly and indexes correct - for (int i = 6; i < model.count()-6 && i < itemCount+6; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->x() == (i%3)*80); - QVERIFY(item->y() == (i/3)*60); - name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - delete canvas; -} - -void tst_QmlGraphicsGridView::currentIndex() -{ - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), QString::number(i)); - - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - QString filename(SRCDIR "/data/gridview-initCurrent.qml"); - canvas->setSource(QUrl::fromLocalFile(filename)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(500); - - // current item should be third item - QCOMPARE(gridview->currentIndex(), 5); - QCOMPARE(gridview->currentItem(), findItem<QmlGraphicsItem>(viewport, "wrapper", 5)); - QCOMPARE(gridview->currentItem()->y(), gridview->highlightItem()->y()); - - gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 6); - gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), 9); - gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 6); - gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 5); - - // no wrap - gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); - - gridview->moveCurrentIndexUp(); - QCOMPARE(gridview->currentIndex(), 0); - - gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), 0); - - gridview->setCurrentIndex(model.count()-1); - QTest::qWait(500); - QCOMPARE(gridview->currentIndex(), model.count()-1); - - gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), model.count()-1); - - gridview->moveCurrentIndexDown(); - QCOMPARE(gridview->currentIndex(), model.count()-1); - - // with wrap - gridview->setWrapEnabled(true); - - gridview->setCurrentIndex(0); - QCOMPARE(gridview->currentIndex(), 0); - QTest::qWait(500); - - gridview->moveCurrentIndexLeft(); - QCOMPARE(gridview->currentIndex(), model.count()-1); - - QTest::qWait(500); - QCOMPARE(gridview->viewportY(), 279.0); - - gridview->moveCurrentIndexRight(); - QCOMPARE(gridview->currentIndex(), 0); - - QTest::qWait(500); - QCOMPARE(gridview->viewportY(), 0.0); - - // Test keys - qApp->setActiveWindow(canvas); - canvas->show(); - canvas->setFocus(); - qApp->processEvents(); - - QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 3); - - QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); - - gridview->setFlow(QmlGraphicsGridView::TopToBottom); - - QTest::keyClick(canvas, Qt::Key_Right); - QCOMPARE(gridview->currentIndex(), 5); - - QTest::keyClick(canvas, Qt::Key_Left); - QCOMPARE(gridview->currentIndex(), 0); - - QTest::keyClick(canvas, Qt::Key_Down); - QCOMPARE(gridview->currentIndex(), 1); - - QTest::keyClick(canvas, Qt::Key_Up); - QCOMPARE(gridview->currentIndex(), 0); - - - // 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(); - - gridview->setCurrentIndex(5); - QTest::qWait(500); - QCOMPARE(gridview->highlightItem()->x(), hlPosX); - QCOMPARE(gridview->highlightItem()->y(), hlPosY); - - delete canvas; -} - -void tst_QmlGraphicsGridView::changeFlow() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), QString::number(i)); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - // Confirm items positioned correctly and indexes correct - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i%3)*80)); - QCOMPARE(item->y(), qreal((i/3)*60)); - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - ctxt->setContextProperty("testTopToBottom", QVariant(true)); - QTest::qWait(500); - - // Confirm items positioned correctly and indexes correct - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), qreal((i/5)*80)); - QCOMPARE(item->y(), qreal((i%5)*60)); - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - delete canvas; -} - -void tst_QmlGraphicsGridView::defaultValues() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview3.qml")); - QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->model() == QVariant()); - QVERIFY(obj->delegate() == 0); - QCOMPARE(obj->currentIndex(), -1); - QVERIFY(obj->currentItem() == 0); - QCOMPARE(obj->count(), 0); - QVERIFY(obj->highlight() == 0); - QVERIFY(obj->highlightItem() == 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), true); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), false); - QCOMPARE(obj->cacheBuffer(), 0); - QCOMPARE(obj->cellWidth(), 100); //### Should 100 be the default? - QCOMPARE(obj->cellHeight(), 100); - delete obj; -} - -void tst_QmlGraphicsGridView::properties() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/gridview2.qml")); - QmlGraphicsGridView *obj = qobject_cast<QmlGraphicsGridView*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->model() != QVariant()); - QVERIFY(obj->delegate() != 0); - QCOMPARE(obj->currentIndex(), 0); - QVERIFY(obj->currentItem() != 0); - QCOMPARE(obj->count(), 4); - QVERIFY(obj->highlight() != 0); - QVERIFY(obj->highlightItem() != 0); - QCOMPARE(obj->highlightFollowsCurrentItem(), false); - QVERIFY(obj->flow() == 0); - QCOMPARE(obj->isWrapEnabled(), true); - QCOMPARE(obj->cacheBuffer(), 200); - QCOMPARE(obj->cellWidth(), 100); - QCOMPARE(obj->cellHeight(), 100); - delete obj; -} - -void tst_QmlGraphicsGridView::positionViewAtIndex() -{ - QmlView *canvas = createView(SRCDIR "/data/gridview.qml"); - - TestModel model; - for (int i = 0; i < 40; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testTopToBottom", QVariant(false)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsGridView *gridview = findItem<QmlGraphicsGridView>(canvas->rootObject(), "grid"); - QVERIFY(gridview != 0); - - QmlGraphicsItem *viewport = gridview->viewport(); - QVERIFY(viewport != 0); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); - } - - // Position on a currently visible item - gridview->positionViewAtIndex(4); - QCOMPARE(gridview->viewportY(), 60.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); - } - - // Position on an item beyond the visible items - gridview->positionViewAtIndex(21); - QCOMPARE(gridview->viewportY(), 420.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); - } - - // Position on an item that would leave empty space if positioned at the top - gridview->positionViewAtIndex(31); - QCOMPARE(gridview->viewportY(), 520.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); - } - - // Position at the beginning again - gridview->positionViewAtIndex(0); - QCOMPARE(gridview->viewportY(), 0.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->x(), (i%3)*80.); - QCOMPARE(item->y(), (i/3)*60.); - } - - delete canvas; -} - -QmlView *tst_QmlGraphicsGridView::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -/* - Find an item with the specified objectName. If index is supplied then the - item must also evaluate the {index} expression equal to index -*/ -template<typename T> -T *tst_QmlGraphicsGridView::findItem(QGraphicsObject *parent, const QString &objectName, int index) -{ - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->childItems().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - if (index != -1) { - QmlContext *context = QmlEngine::contextForObject(item); - if (context) { - if (context->contextProperty("index").toInt() == index) { - return static_cast<T*>(item); - } - } - } else { - return static_cast<T*>(item); - } - } - item = findItem<T>(item, objectName, index); - if (item) - return static_cast<T*>(item); - } - - return 0; -} - -template<typename T> -QList<T*> tst_QmlGraphicsGridView::findItems(QGraphicsObject *parent, const QString &objectName) -{ - QList<T*> items; - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->childItems().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - items.append(static_cast<T*>(item)); - //qDebug() << " found:" << item; - } - items += findItems<T>(item, objectName); - } - - return items; -} - -void tst_QmlGraphicsGridView::dumpTree(QmlGraphicsItem *parent, int depth) -{ - static QString padding(" "); - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - QmlContext *context = QmlEngine::contextForObject(item); - qDebug() << padding.left(depth*2) << item << (context ? context->contextProperty("index").toInt() : -1); - dumpTree(item, depth+1); - } -} - - -QTEST_MAIN(tst_QmlGraphicsGridView) - -#include "tst_qmlgraphicsgridview.moc" diff --git a/tests/auto/declarative/qmlgraphicsimage/qmlgraphicsimage.pro b/tests/auto/declarative/qmlgraphicsimage/qmlgraphicsimage.pro deleted file mode 100644 index b5f7f83..0000000 --- a/tests/auto/declarative/qmlgraphicsimage/qmlgraphicsimage.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui network -macx:CONFIG -= app_bundle - -HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsimage.cpp ../shared/testhttpserver.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp deleted file mode 100644 index a25dcd2..0000000 --- a/tests/auto/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ /dev/null @@ -1,247 +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 <qtest.h> -#include <QTextDocument> -#include <QTcpServer> -#include <QTcpSocket> -#include <QDir> - -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsimage_p.h> -#include <private/qmlgraphicsimagebase_p.h> -#include <private/qmlgraphicsloader_p.h> -#include <QtDeclarative/qmlcontext.h> - -#include "../shared/testhttpserver.h" - - -#define SERVER_PORT 14445 -#define SERVER_ADDR "http://127.0.0.1:14445" - -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 60; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - -class tst_qmlgraphicsimage : public QObject - -{ - Q_OBJECT -public: - tst_qmlgraphicsimage(); - -private slots: - void noSource(); - void imageSource(); - void imageSource_data(); - void clearSource(); - void resized(); - void smooth(); - void pixmap(); - -private: - QmlEngine engine; -}; - -tst_qmlgraphicsimage::tst_qmlgraphicsimage() -{ -} - -void tst_qmlgraphicsimage::noSource() -{ - QString componentStr = "import Qt 4.6\nImage { source: \"\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->source(), QUrl()); - QVERIFY(obj->status() == QmlGraphicsImage::Null); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - QCOMPARE(obj->progress(), 0.0); - - delete obj; -} - -void tst_qmlgraphicsimage::imageSource_data() -{ - QTest::addColumn<QString>("source"); - QTest::addColumn<bool>("remote"); - QTest::addColumn<QString>("error"); - - QTest::newRow("local") << QUrl::fromLocalFile(SRCDIR "/data/colors.png").toString() << false << ""; - QTest::newRow("local not found") << QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() << false - << "Cannot open QUrl( \"" + QUrl::fromLocalFile(SRCDIR "/data/no-such-file.png").toString() + "\" ) "; - QTest::newRow("remote") << SERVER_ADDR "/colors.png" << true << ""; - QTest::newRow("remote not found") << SERVER_ADDR "/no-such-file.png" << true - << "\"Error downloading " SERVER_ADDR "/no-such-file.png - server replied: Not found\" "; -} - -void tst_qmlgraphicsimage::imageSource() -{ - QFETCH(QString, source); - QFETCH(bool, remote); - QFETCH(QString, error); - - TestHTTPServer server(SERVER_PORT); - if (remote) { - QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); - } - - if (!error.isEmpty()) - QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - - if (remote) - TRY_WAIT(obj->status() == QmlGraphicsImage::Loading); - - QCOMPARE(obj->source(), remote ? source : QUrl(source)); - - if (error.isEmpty()) { - TRY_WAIT(obj->status() == QmlGraphicsImage::Ready); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - QCOMPARE(obj->progress(), 1.0); - } else { - TRY_WAIT(obj->status() == QmlGraphicsImage::Error); - } - - delete obj; -} - -void tst_qmlgraphicsimage::clearSource() -{ - QString componentStr = "import Qt 4.6\nImage { source: srcImage }"; - QmlContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("srcImage", QUrl::fromLocalFile(SRCDIR "/data/colors.png")); - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - QVERIFY(obj->status() == QmlGraphicsImage::Ready); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - QCOMPARE(obj->progress(), 1.0); - - ctxt->setContextProperty("srcImage", ""); - QVERIFY(obj->source().isEmpty()); - QVERIFY(obj->status() == QmlGraphicsImage::Null); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); - QCOMPARE(obj->progress(), 0.0); -} - -void tst_qmlgraphicsimage::resized() -{ - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsimage::smooth() -{ - QString componentStr = "import Qt 4.6\nImage { source: \"" SRCDIR "/data/colors.png\"; smooth: true; width: 300; height: 300 }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->width(), 300.); - QCOMPARE(obj->height(), 300.); - QCOMPARE(obj->smooth(), true); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - - delete obj; -} - -void tst_qmlgraphicsimage::pixmap() -{ - QString componentStr = "import Qt 4.6\nImage { pixmap: testPixmap }"; - - QPixmap pixmap; - QmlContext *ctxt = engine.rootContext(); - ctxt->setContextProperty("testPixmap", pixmap); - - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - QCOMPARE(obj->source(), QUrl()); - QVERIFY(obj->status() == QmlGraphicsImage::Null); - QCOMPARE(obj->width(), 0.); - QCOMPARE(obj->height(), 0.); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - QCOMPARE(obj->progress(), 0.0); - QVERIFY(obj->pixmap().isNull()); - - pixmap = QPixmap(SRCDIR "/data/colors.png"); - ctxt->setContextProperty("testPixmap", pixmap); - QCOMPARE(obj->width(), 120.); - QCOMPARE(obj->height(), 120.); - QVERIFY(obj->status() == QmlGraphicsImage::Ready); - - delete obj; -} - -QTEST_MAIN(tst_qmlgraphicsimage) - -#include "tst_qmlgraphicsimage.moc" diff --git a/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro b/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro deleted file mode 100644 index ddabf9a..0000000 --- a/tests/auto/declarative/qmlgraphicsitem/qmlgraphicsitem.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsitem.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp b/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp deleted file mode 100644 index 820a6de..0000000 --- a/tests/auto/declarative/qmlgraphicsitem/tst_qmlgraphicsitem.cpp +++ /dev/null @@ -1,321 +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 <qtest.h> -#include <QtTest/QSignalSpy> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlview.h> -#include <QtDeclarative/qmlgraphicsitem.h> - -class tst_QmlGraphicsItem : public QObject - -{ - Q_OBJECT -public: - tst_QmlGraphicsItem(); - -private slots: - void keys(); - void keyNavigation(); - void smooth(); - void clip(); - -private: - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &objectName); - QmlEngine engine; -}; - -class KeysTestObject : public QObject -{ - Q_OBJECT -public: - KeysTestObject() : mKey(0), mModifiers(0), mForwardedKey(0) {} - - void reset() { - mKey = 0; - mText = QString(); - mModifiers = 0; - mForwardedKey = 0; - } - -public slots: - void keyPress(int key, QString text, int modifiers) { - mKey = key; - mText = text; - mModifiers = modifiers; - } - void keyRelease(int key, QString text, int modifiers) { - mKey = key; - mText = text; - mModifiers = modifiers; - } - void forwardedKey(int key) { - mForwardedKey = key; - } - -public: - int mKey; - QString mText; - int mModifiers; - int mForwardedKey; - -private: -}; - - -tst_QmlGraphicsItem::tst_QmlGraphicsItem() -{ -} - -void tst_QmlGraphicsItem::keys() -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keys.qml")); - - KeysTestObject *testObject = new KeysTestObject; - canvas->rootContext()->setContextProperty("keysTestObject", testObject); - - canvas->rootContext()->setContextProperty("enableKeyHanding", QVariant(true)); - - canvas->execute(); - canvas->show(); - qApp->processEvents(); - - QEvent wa(QEvent::WindowActivate); - QApplication::sendEvent(canvas, &wa); - QFocusEvent fe(QEvent::FocusIn); - QApplication::sendEvent(canvas, &fe); - - QKeyEvent key(QEvent::KeyPress, Qt::Key_A, Qt::NoModifier, "A", false, 1); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, int(Qt::Key_A)); - QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A)); - QCOMPARE(testObject->mText, QLatin1String("A")); - QVERIFY(testObject->mModifiers == Qt::NoModifier); - QVERIFY(!key.isAccepted()); - - testObject->reset(); - - key = QKeyEvent(QEvent::KeyRelease, Qt::Key_A, Qt::ShiftModifier, "A", false, 1); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, int(Qt::Key_A)); - QCOMPARE(testObject->mForwardedKey, int(Qt::Key_A)); - QCOMPARE(testObject->mText, QLatin1String("A")); - QVERIFY(testObject->mModifiers == Qt::ShiftModifier); - QVERIFY(key.isAccepted()); - - testObject->reset(); - - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Return, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, int(Qt::Key_Return)); - QCOMPARE(testObject->mForwardedKey, int(Qt::Key_Return)); - QCOMPARE(testObject->mText, QLatin1String("Return")); - QVERIFY(testObject->mModifiers == Qt::NoModifier); - QVERIFY(key.isAccepted()); - - testObject->reset(); - - key = QKeyEvent(QEvent::KeyPress, Qt::Key_0, Qt::NoModifier, "0", false, 1); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, int(Qt::Key_0)); - QCOMPARE(testObject->mForwardedKey, int(Qt::Key_0)); - QCOMPARE(testObject->mText, QLatin1String("0")); - QVERIFY(testObject->mModifiers == Qt::NoModifier); - QVERIFY(key.isAccepted()); - - testObject->reset(); - - key = QKeyEvent(QEvent::KeyPress, Qt::Key_9, Qt::NoModifier, "9", false, 1); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, int(Qt::Key_9)); - QCOMPARE(testObject->mForwardedKey, int(Qt::Key_9)); - QCOMPARE(testObject->mText, QLatin1String("9")); - 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); - QApplication::sendEvent(canvas, &key); - QCOMPARE(testObject->mKey, 0); - QVERIFY(!key.isAccepted()); - - delete canvas; - delete testObject; -} - -void tst_QmlGraphicsItem::keyNavigation() -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(SRCDIR "/data/keynavigation.qml")); - canvas->execute(); - canvas->show(); - qApp->processEvents(); - - QEvent wa(QEvent::WindowActivate); - QApplication::sendEvent(canvas, &wa); - QFocusEvent fe(QEvent::FocusIn); - QApplication::sendEvent(canvas, &fe); - - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item1"); - QVERIFY(item); - QVERIFY(item->hasFocus()); - - // right - QKeyEvent key(QEvent::KeyPress, Qt::Key_Right, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - - item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item2"); - QVERIFY(item); - QVERIFY(item->hasFocus()); - - // down - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - - item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item4"); - QVERIFY(item); - QVERIFY(item->hasFocus()); - - // left - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Left, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - - item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item3"); - QVERIFY(item); - QVERIFY(item->hasFocus()); - - // up - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - - item = findItem<QmlGraphicsItem>(canvas->rootObject(), "item1"); - QVERIFY(item); - QVERIFY(item->hasFocus()); -} - -void tst_QmlGraphicsItem::smooth() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6; Item { smooth: false; }", QUrl::fromLocalFile("")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QSignalSpy spy(item, SIGNAL(smoothChanged())); - - QVERIFY(item); - QVERIFY(!item->smooth()); - - item->setSmooth(true); - QVERIFY(item->smooth()); - QCOMPARE(spy.count(),1); - item->setSmooth(true); - QCOMPARE(spy.count(),1); - - item->setSmooth(false); - QVERIFY(!item->smooth()); - QCOMPARE(spy.count(),2); - item->setSmooth(false); - QCOMPARE(spy.count(),2); -} - -void tst_QmlGraphicsItem::clip() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6\nItem { clip: false\n }", QUrl::fromLocalFile("")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QSignalSpy spy(item, SIGNAL(clipChanged())); - - QVERIFY(item); - QVERIFY(!item->clip()); - - item->setClip(true); - QVERIFY(item->clip()); - QCOMPARE(spy.count(),1); - item->setClip(true); - QCOMPARE(spy.count(),1); - - item->setClip(false); - QVERIFY(!item->clip()); - QCOMPARE(spy.count(),2); - item->setClip(false); - QCOMPARE(spy.count(),2); -} - -template<typename T> -T *tst_QmlGraphicsItem::findItem(QGraphicsObject *parent, const QString &objectName) -{ - if (!parent) - return 0; - - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->QGraphicsObject::children().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) - return static_cast<T*>(item); - item = findItem<T>(item, objectName); - if (item) - return static_cast<T*>(item); - } - - return 0; -} - - - -QTEST_MAIN(tst_QmlGraphicsItem) - -#include "tst_qmlgraphicsitem.moc" diff --git a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml b/tests/auto/declarative/qmlgraphicslistview/data/listview.qml deleted file mode 100644 index 99b3db6..0000000 --- a/tests/auto/declarative/qmlgraphicslistview/data/listview.qml +++ /dev/null @@ -1,119 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 240 - height: 320 - color: "#ffffff" - function checkProperties() { - testObject.error = false; - if (list.model != testModel) { - console.log("model property incorrect"); - testObject.error = true; - } - if (!testObject.animate && list.delegate != myDelegate) { - console.log("delegate property incorrect - expected myDelegate"); - testObject.error = true; - } - if (testObject.animate && list.delegate != animatedDelegate) { - console.log("delegate property incorrect - expected animatedDelegate"); - testObject.error = true; - } - if (testObject.invalidHighlight && list.highlight != invalidHl) { - console.log("highlight property incorrect - expected invalidHl"); - testObject.error = true; - } - if (!testObject.invalidHighlight && list.highlight != myHighlight) { - console.log("highlight property incorrect - expected myHighlight"); - testObject.error = true; - } - } - resources: [ - Component { - id: myDelegate - Rectangle { - id: wrapper - objectName: "wrapper" - height: 20 - width: 240 - Text { - text: index - } - Text { - x: 30 - id: textName - objectName: "textName" - text: name - } - Text { - x: 120 - id: textNumber - objectName: "textNumber" - text: number - } - Text { - x: 200 - text: wrapper.y - } - color: ListView.isCurrentItem ? "lightsteelblue" : "white" - } - }, - Component { - id: animatedDelegate - Rectangle { - id: wrapper - objectName: "wrapper" - height: 20 - width: 240 - Text { - text: index - } - Text { - x: 30 - id: textName - objectName: "textName" - text: name - } - Text { - x: 120 - id: textNumber - objectName: "textNumber" - text: number - } - Text { - x: 200 - text: wrapper.y - } - color: ListView.isCurrentItem ? "lightsteelblue" : "white" - ListView.onRemove: SequentialAnimation { - ScriptAction { script: console.log("Fix PropertyAction with attached properties") } -/* - PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: true } - NumberAnimation { target: wrapper; property: "scale"; to: 0; duration: 250; easing: "easeInOutQuad" } - PropertyAction { target: wrapper; property: "ListView.delayRemove"; value: false } -*/ - } - } - }, - Component { - id: myHighlight - Rectangle { color: "green" } - }, - Component { - id: invalidHl - EaseFollow {} - } - ] - ListView { - id: list - objectName: "list" - focus: true - width: 240 - height: 320 - model: testModel - delegate: testObject.animate ? animatedDelegate : myDelegate - highlight: testObject.invalidHighlight ? invalidHl : myHighlight - highlightMoveSpeed: 1000 - highlightResizeSpeed: 1000 - cacheBuffer: testObject.cacheBuffer - } -} diff --git a/tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro b/tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro deleted file mode 100644 index f00de39..0000000 --- a/tests/auto/declarative/qmlgraphicslistview/qmlgraphicslistview.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicslistview.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp b/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp deleted file mode 100644 index 13ed41d..0000000 --- a/tests/auto/declarative/qmlgraphicslistview/tst_qmlgraphicslistview.cpp +++ /dev/null @@ -1,1374 +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 <QtTest/QtTest> -#include <private/qlistmodelinterface_p.h> -#include <qmlview.h> -#include <private/qmlgraphicslistview_p.h> -#include <private/qmlgraphicstext_p.h> -#include <private/qmlgraphicsvisualitemmodel_p.h> -#include <qmlcontext.h> -#include <qmlexpression.h> - -class tst_QmlGraphicsListView : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsListView(); - -private slots: - // Test both QListModelInterface and QAbstractItemModel model types - void qListModelInterface_items(); - void qAbstractItemModel_items(); - - void qListModelInterface_changed(); - void qAbstractItemModel_changed(); - - void qListModelInterface_inserted(); - void qAbstractItemModel_inserted(); - - void qListModelInterface_removed(); - void qAbstractItemModel_removed(); - - void qListModelInterface_moved(); - void qAbstractItemModel_moved(); - - void qListModelInterface_clear(); - void qAbstractItemModel_clear(); - - void itemList(); - void currentIndex(); - void enforceRange(); - void spacing(); - void sections(); - void cacheBuffer(); - void positionViewAtIndex(); - -private: - template <class T> void items(); - template <class T> void changed(); - template <class T> void inserted(); - template <class T> void removed(bool animated); - template <class T> void moved(); - template <class T> void clear(); - QmlView *createView(const QString &filename); - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &id, int index=-1); - template<typename T> - QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); - void dumpTree(QmlGraphicsItem *parent, int depth = 0); -}; - -class TestObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool error READ error WRITE setError NOTIFY changedError) - Q_PROPERTY(bool animate READ animate NOTIFY changedAnim) - Q_PROPERTY(bool invalidHighlight READ invalidHighlight NOTIFY changedHl) - Q_PROPERTY(int cacheBuffer READ cacheBuffer NOTIFY changedCacheBuffer) - -public: - TestObject(QObject *parent = 0) - : QObject(parent), mError(true), mAnimate(false), mInvalidHighlight(false) - , mCacheBuffer(0) {} - - bool error() const { return mError; } - void setError(bool err) { mError = err; emit changedError(); } - - bool animate() const { return mAnimate; } - void setAnimate(bool anim) { mAnimate = anim; emit changedAnim(); } - - bool invalidHighlight() const { return mInvalidHighlight; } - void setInvalidHighlight(bool invalid) { mInvalidHighlight = invalid; emit changedHl(); } - - int cacheBuffer() const { return mCacheBuffer; } - void setCacheBuffer(int buffer) { mCacheBuffer = buffer; emit changedCacheBuffer(); } - -signals: - void changedError(); - void changedAnim(); - void changedHl(); - void changedCacheBuffer(); - -public: - bool mError; - bool mAnimate; - bool mInvalidHighlight; - int mCacheBuffer; -}; - -class TestModel : public QListModelInterface -{ - Q_OBJECT -public: - TestModel(QObject *parent = 0) : QListModelInterface(parent) {} - ~TestModel() {} - - enum Roles { Name, Number }; - - QString name(int index) const { return list.at(index).first; } - QString number(int index) const { return list.at(index).second; } - - int count() const { return list.count(); } - - QList<int> roles() const { return QList<int>() << Name << Number; } - QString toString(int role) const { - switch(role) { - case Name: - return "name"; - case Number: - return "number"; - default: - return ""; - } - } - - QVariant data(int index, int role) const - { - if (role==0) - return list.at(index).first; - if (role==1) - return list.at(index).second; - return QVariant(); - } - QHash<int, QVariant> data(int index, const QList<int> &roles) const { - QHash<int,QVariant> returnHash; - - for (int i = 0; i < roles.size(); ++i) { - int role = roles.at(i); - QVariant info; - switch(role) { - case Name: - info = list.at(index).first; - break; - case Number: - info = list.at(index).second; - break; - default: - break; - } - returnHash.insert(role, info); - } - return returnHash; - } - - void addItem(const QString &name, const QString &number) { - list.append(QPair<QString,QString>(name, number)); - emit itemsInserted(list.count()-1, 1); - } - - void insertItem(int index, const QString &name, const QString &number) { - list.insert(index, QPair<QString,QString>(name, number)); - emit itemsInserted(index, 1); - } - - void removeItem(int index) { - list.removeAt(index); - emit itemsRemoved(index, 1); - } - - void moveItem(int from, int to) { - list.move(from, to); - emit itemsMoved(from, to, 1); - } - - void modifyItem(int index, const QString &name, const QString &number) { - list[index] = QPair<QString,QString>(name, number); - emit itemsChanged(index, 1, roles()); - } - - void clear() { - int count = list.count(); - list.clear(); - emit itemsRemoved(0, count); - } - -private: - QList<QPair<QString,QString> > list; -}; - - -class TestModel2 : public QAbstractListModel -{ -public: - enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; - - TestModel2(QObject *parent=0) : QAbstractListModel(parent) { - QHash<int, QByteArray> roles; - roles[Name] = "name"; - roles[Number] = "number"; - setRoleNames(roles); - } - - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { - QVariant rv; - if (role == Name) - rv = list.at(index.row()).first; - else if (role == Number) - rv = list.at(index.row()).second; - - return rv; - } - - int count() const { return rowCount(); } - QString name(int index) const { return list.at(index).first; } - QString number(int index) const { return list.at(index).second; } - - void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); - list.append(QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); - list.insert(index, QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); - list.removeAt(index); - emit endRemoveRows(); - } - - void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); - list.move(from, to); - emit endMoveRows(); - } - - void modifyItem(int idx, const QString &name, const QString &number) { - list[idx] = QPair<QString,QString>(name, number); - emit dataChanged(index(idx,0), index(idx,0)); - } - - void clear() { - int count = list.count(); - emit beginRemoveRows(QModelIndex(), 0, count-1); - list.clear(); - emit endRemoveRows(); - } - -private: - QList<QPair<QString,QString> > list; -}; - -tst_QmlGraphicsListView::tst_QmlGraphicsListView() -{ -} - -template <class T> -void tst_QmlGraphicsListView::items() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - - QVERIFY(listview->highlightItem() != 0); - QCOMPARE(listview->count(), model.count()); - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - // current item should be first item - QCOMPARE(listview->currentItem(), findItem<QmlGraphicsItem>(viewport, "wrapper", 0)); - - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - // switch to other delegate - testObject->setAnimate(true); - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - - // set invalid highlight - testObject->setInvalidHighlight(true); - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() == 0); - - // back to normal highlight - testObject->setInvalidHighlight(false); - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - QVERIFY(listview->currentItem()); - QVERIFY(listview->highlightItem() != 0); - - // set an empty model and confirm that items are destroyed - T model2; - ctxt->setContextProperty("testModel", &model2); - - // Allow deleteLaters to process - QTest::qWait(500); - - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - QVERIFY(itemCount == 0); - - QCOMPARE(listview->highlightResizeSpeed(), 1000.0); - QCOMPARE(listview->highlightMoveSpeed(), 1000.0); - - delete canvas; -} - -template <class T> -void tst_QmlGraphicsListView::changed() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsFlickable *listview = findItem<QmlGraphicsFlickable>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - model.modifyItem(1, "Will", "9876"); - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - delete canvas; -} - -template <class T> -void tst_QmlGraphicsListView::inserted() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - model.insertItem(1, "Will", "9876"); - - // let transitions settle. - QTest::qWait(500); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - // Confirm items positioned correctly - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); - } - - model.insertItem(0, "Foo", "1111"); // zero index, and current item - - // let transitions settle. - QTest::qWait(500); - - QCOMPARE(viewport->childItems().count(), model.count()+1); // assumes all are visible, +1 for the (default) highlight item - - name = findItem<QmlGraphicsText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); - - QCOMPARE(listview->currentIndex(), 1); - - // Confirm items positioned correctly - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - QCOMPARE(item->y(), i*20.0); - } - - for (int i = model.count(); i < 30; ++i) - model.insertItem(i, "Hello", QString::number(i)); - QTest::qWait(500); - - listview->setViewportY(80); - QTest::qWait(500); - - // Insert item outside visible area - model.insertItem(1, "Hello", "1324"); - QTest::qWait(500); - - QVERIFY(listview->viewportY() == 80); - - // Confirm items positioned correctly - for (int i = 5; i < 5+15; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 - 20.0); - } - -// QCOMPARE(listview->viewportHeight(), model.count() * 20.0); - - delete canvas; -} - -template <class T> -void tst_QmlGraphicsListView::removed(bool animated) -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - testObject->setAnimate(animated); - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - model.removeItem(1); - - // let transitions settle. - QTest::qWait(500); - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); - } - - // Remove first item (which is the current item); - model.removeItem(0); // post: top item starts at 20 - - // let transitions settle. - QTest::qWait(500); - - name = findItem<QmlGraphicsText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0 + 20.0); - } - - // Remove items not visible - model.removeItem(18); - // let transitions settle. - QTest::qWait(500); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),i*20.0+20.0); - } - - // Remove items before visible - listview->setViewportY(80); - listview->setCurrentIndex(10); - - model.removeItem(1); // post: top item will be at 40 - // let transitions settle. - QTest::qWait(500); - - // Confirm items positioned correctly - for (int i = 2; i < 18; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); - } - - // Remove current index - QVERIFY(listview->currentIndex() == 9); - QmlGraphicsItem *oldCurrent = listview->currentItem(); - model.removeItem(9); - QTest::qWait(500); - - QCOMPARE(listview->currentIndex(), 9); - QVERIFY(listview->currentItem() != oldCurrent); - - listview->setViewportY(40); // That's the top now - // let transitions settle. - QTest::qWait(500); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(),40+i*20.0); - } - - // remove current item beyond visible items. - listview->setCurrentIndex(20); - QTest::qWait(500); - listview->setViewportY(40); - model.removeItem(20); - QTest::qWait(500); - - QCOMPARE(listview->currentIndex(), 20); - QVERIFY(listview->currentItem() != 0); - - // remove item before current, but visible - listview->setCurrentIndex(8); - QTest::qWait(500); - oldCurrent = listview->currentItem(); - model.removeItem(6); - QTest::qWait(500); - - QCOMPARE(listview->currentIndex(), 7); - QVERIFY(listview->currentItem() == oldCurrent); - - delete canvas; -} - -template <class T> -void tst_QmlGraphicsListView::clear() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - model.clear(); - - // let transitions settle. - QTest::qWait(500); - - QVERIFY(listview->count() == 0); - QVERIFY(listview->currentItem() == 0); - QVERIFY(listview->viewportY() == 0); - - delete canvas; -} - - -template <class T> -void tst_QmlGraphicsListView::moved() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - T model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - model.moveItem(1, 4); - - // let transitions settle. - QTest::qWait(500); - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 1); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(1)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 1); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(1)); - - name = findItem<QmlGraphicsText>(viewport, "textName", 4); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(4)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", 4); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(4)); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); - } - - listview->setViewportY(80); - - // move outside visible area - model.moveItem(1, 18); - - // let transitions settle. - QTest::qWait(500); - - // Confirm items positioned correctly and indexes correct - for (int i = 3; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); - name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - // move from outside visible into visible - model.moveItem(20, 4); - - // let transitions settle. - QTest::qWait(500); - - // Confirm items positioned correctly and indexes correct - for (int i = 3; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0 + 20); - name = findItem<QmlGraphicsText>(viewport, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - number = findItem<QmlGraphicsText>(viewport, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - delete canvas; -} - -void tst_QmlGraphicsListView::enforceRange() -{ - QmlView *canvas = createView(SRCDIR "/data/listview-enforcerange.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QCOMPARE(listview->preferredHighlightBegin(), 100.0); - QCOMPARE(listview->preferredHighlightEnd(), 100.0); - QCOMPARE(listview->highlightRangeMode(), QmlGraphicsListView::StrictlyEnforceRange); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - // view should be positioned at the top of the range. - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", 0); - QVERIFY(item); - QCOMPARE(listview->viewportY(), -100.0); - - QmlGraphicsText *name = findItem<QmlGraphicsText>(viewport, "textName", 0); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(0)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(viewport, "textNumber", 0); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(0)); - - // Check currentIndex is updated when viewport moves - listview->setViewportY(20); - QTest::qWait(500); - - QCOMPARE(listview->currentIndex(), 6); - - delete canvas; -} - -void tst_QmlGraphicsListView::spacing() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); - } - - listview->setSpacing(10); - QVERIFY(listview->spacing() == 10); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*30); - } - - listview->setSpacing(0); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.0); - } - - delete canvas; -} - -void tst_QmlGraphicsListView::sections() -{ - QmlView *canvas = createView(SRCDIR "/data/listview-sections.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), QString::number(i/5)); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - QVERIFY(item); - QCOMPARE(item->y(), qreal(i*20 + ((i+4)/5) * 20)); - } - - // Remove section boundary - model.removeItem(5); - - // New section header created - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); - - model.insertItem(3, "New Item", "0"); - - // Section header moved - item = findItem<QmlGraphicsItem>(viewport, "wrapper", 5); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); - - item = findItem<QmlGraphicsItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); - - // insert item which will become a section header - model.insertItem(6, "Replace header", "1"); - - item = findItem<QmlGraphicsItem>(viewport, "wrapper", 6); - QVERIFY(item); - QCOMPARE(item->height(), 40.0); - - item = findItem<QmlGraphicsItem>(viewport, "wrapper", 7); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); - - QCOMPARE(listview->currentSection(), QString("0")); - - listview->setViewportY(140); - QCOMPARE(listview->currentSection(), QString("1")); - - listview->setViewportY(20); - QCOMPARE(listview->currentSection(), QString("0")); - - item = findItem<QmlGraphicsItem>(viewport, "wrapper", 1); - QVERIFY(item); - QCOMPARE(item->height(), 20.0); - - delete canvas; -} - -void tst_QmlGraphicsListView::currentIndex() -{ - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), QString::number(i)); - - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - ctxt->setContextProperty("testWrap", QVariant(false)); - - QString filename(SRCDIR "/data/listview-initCurrent.qml"); - canvas->setSource(QUrl::fromLocalFile(filename)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - QTest::qWait(500); - - // current item should be third item - QCOMPARE(listview->currentIndex(), 3); - QCOMPARE(listview->currentItem(), findItem<QmlGraphicsItem>(viewport, "wrapper", 3)); - QCOMPARE(listview->highlightItem()->y(), listview->currentItem()->y()); - - // no wrap - listview->setCurrentIndex(0); - QCOMPARE(listview->currentIndex(), 0); - - listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 1); - listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); - - listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); - - // with wrap - ctxt->setContextProperty("testWrap", QVariant(true)); - QVERIFY(listview->isWrapEnabled()); - - listview->decrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), model.count()-1); - - QTest::qWait(1000); - QCOMPARE(listview->viewportY(), 279.0); - - listview->incrementCurrentIndex(); - QCOMPARE(listview->currentIndex(), 0); - - QTest::qWait(1000); - QCOMPARE(listview->viewportY(), 0.0); - - // Test keys - canvas->show(); - qApp->processEvents(); - - QEvent wa(QEvent::WindowActivate); - QApplication::sendEvent(canvas, &wa); - QFocusEvent fe(QEvent::FocusIn); - QApplication::sendEvent(canvas, &fe); - - QKeyEvent key(QEvent::KeyPress, Qt::Key_Down, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - QCOMPARE(listview->currentIndex(), 1); - - key = QKeyEvent(QEvent::KeyPress, Qt::Key_Up, Qt::NoModifier, "", false, 1); - QApplication::sendEvent(canvas, &key); - QVERIFY(key.isAccepted()); - QCOMPARE(listview->currentIndex(), 0); - - // turn off auto highlight - listview->setHighlightFollowsCurrentItem(false); - QVERIFY(listview->highlightFollowsCurrentItem() == false); - - QTest::qWait(500); - QVERIFY(listview->highlightItem()); - qreal hlPos = listview->highlightItem()->y(); - - listview->setCurrentIndex(4); - QTest::qWait(500); - QCOMPARE(listview->highlightItem()->y(), hlPos); - - delete canvas; -} - -void tst_QmlGraphicsListView::itemList() -{ - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "view"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - QmlGraphicsVisualItemModel *model = canvas->rootObject()->findChild<QmlGraphicsVisualItemModel*>("itemModel"); - QVERIFY(model != 0); - - QVERIFY(model->count() == 3); - QCOMPARE(listview->currentIndex(), 0); - - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "item1"); - QVERIFY(item); - QCOMPARE(item->x(), 0.0); - - QmlGraphicsText *text = findItem<QmlGraphicsText>(viewport, "text1"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 0")); - - listview->setCurrentIndex(2); - QTest::qWait(1000); - - item = findItem<QmlGraphicsItem>(viewport, "item3"); - QVERIFY(item); - QCOMPARE(item->x(), 480.0); - - text = findItem<QmlGraphicsText>(viewport, "text3"); - QVERIFY(text); - QCOMPARE(text->text(), QLatin1String("index: 2")); - - delete canvas; -} - -void tst_QmlGraphicsListView::cacheBuffer() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - TestModel model; - for (int i = 0; i < 30; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - QVERIFY(listview->delegate() != 0); - QVERIFY(listview->model() != 0); - QVERIFY(listview->highlight() != 0); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); - } - - testObject->setCacheBuffer(400); - QVERIFY(listview->cacheBuffer() == 400); - - int newItemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - QVERIFY(newItemCount > itemCount); - - // Confirm items positioned correctly - for (int i = 0; i < model.count() && i < newItemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QVERIFY(item->y() == i*20); - } - - delete canvas; -} - -void tst_QmlGraphicsListView::positionViewAtIndex() -{ - QmlView *canvas = createView(SRCDIR "/data/listview.qml"); - - TestModel model; - for (int i = 0; i < 40; i++) - model.addItem("Item" + QString::number(i), ""); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsListView *listview = findItem<QmlGraphicsListView>(canvas->rootObject(), "list"); - QVERIFY(listview != 0); - - QmlGraphicsItem *viewport = listview->viewport(); - QVERIFY(viewport != 0); - - // Confirm items positioned correctly - int itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); - } - - // Position on a currently visible item - listview->positionViewAtIndex(3); - QCOMPARE(listview->viewportY(), 60.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 3; i < model.count() && i < itemCount-3-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); - } - - // Position on an item beyond the visible items - listview->positionViewAtIndex(22); - QCOMPARE(listview->viewportY(), 440.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 22; i < model.count() && i < itemCount-22-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); - } - - // Position on an item that would leave empty space if positioned at the top - listview->positionViewAtIndex(28); - QCOMPARE(listview->viewportY(), 480.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 24; i < model.count() && i < itemCount-24-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); - } - - // Position at the beginning again - listview->positionViewAtIndex(0); - QCOMPARE(listview->viewportY(), 0.); - - // Confirm items positioned correctly - itemCount = findItems<QmlGraphicsItem>(viewport, "wrapper").count(); - for (int i = 0; i < model.count() && i < itemCount-1; ++i) { - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(viewport, "wrapper", i); - if (!item) qWarning() << "Item" << i << "not found"; - QVERIFY(item); - QCOMPARE(item->y(), i*20.); - } - - delete canvas; -} - -void tst_QmlGraphicsListView::qListModelInterface_items() -{ - items<TestModel>(); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_items() -{ - items<TestModel2>(); -} - -void tst_QmlGraphicsListView::qListModelInterface_changed() -{ - changed<TestModel>(); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_changed() -{ - changed<TestModel2>(); -} - -void tst_QmlGraphicsListView::qListModelInterface_inserted() -{ - inserted<TestModel>(); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_inserted() -{ - inserted<TestModel2>(); -} - -void tst_QmlGraphicsListView::qListModelInterface_removed() -{ - removed<TestModel>(false); - removed<TestModel>(true); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_removed() -{ - removed<TestModel2>(false); - removed<TestModel2>(true); -} - -void tst_QmlGraphicsListView::qListModelInterface_moved() -{ - moved<TestModel>(); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_moved() -{ - moved<TestModel2>(); -} - -void tst_QmlGraphicsListView::qListModelInterface_clear() -{ - clear<TestModel>(); -} - -void tst_QmlGraphicsListView::qAbstractItemModel_clear() -{ - clear<TestModel2>(); -} - -QmlView *tst_QmlGraphicsListView::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -/* - Find an item with the specified objectName. If index is supplied then the - item must also evaluate the {index} expression equal to index -*/ -template<typename T> -T *tst_QmlGraphicsListView::findItem(QGraphicsObject *parent, const QString &objectName, int index) -{ - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->childItems().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - if (index != -1) { - QmlExpression e(qmlContext(item), "index", item); - e.setTrackChange(false); - if (e.value().toInt() == index) - return static_cast<T*>(item); - } else { - return static_cast<T*>(item); - } - } - item = findItem<T>(item, objectName, index); - if (item) - return static_cast<T*>(item); - } - - return 0; -} - -template<typename T> -QList<T*> tst_QmlGraphicsListView::findItems(QGraphicsObject *parent, const QString &objectName) -{ - QList<T*> items; - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->childItems().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) - items.append(static_cast<T*>(item)); - items += findItems<T>(item, objectName); - } - - return items; -} - -void tst_QmlGraphicsListView::dumpTree(QmlGraphicsItem *parent, int depth) -{ - static QString padding(" "); - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - qDebug() << padding.left(depth*2) << item; - dumpTree(item, depth+1); - } -} - - -QTEST_MAIN(tst_QmlGraphicsListView) - -#include "tst_qmlgraphicslistview.moc" diff --git a/tests/auto/declarative/qmlgraphicsloader/data/GraphicsWidget250x250.qml b/tests/auto/declarative/qmlgraphicsloader/data/GraphicsWidget250x250.qml deleted file mode 100644 index 627c7df..0000000 --- a/tests/auto/declarative/qmlgraphicsloader/data/GraphicsWidget250x250.qml +++ /dev/null @@ -1,5 +0,0 @@ -import Qt 4.6 - -QGraphicsWidget { - size: "250x250" -} diff --git a/tests/auto/declarative/qmlgraphicsloader/qmlgraphicsloader.pro b/tests/auto/declarative/qmlgraphicsloader/qmlgraphicsloader.pro deleted file mode 100644 index 4837075..0000000 --- a/tests/auto/declarative/qmlgraphicsloader/qmlgraphicsloader.pro +++ /dev/null @@ -1,11 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui network -macx:CONFIG -= app_bundle - -INCLUDEPATH += ../shared/ -HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsloader.cpp \ - ../shared/testhttpserver.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" - diff --git a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp b/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp deleted file mode 100644 index 2d3d5ee..0000000 --- a/tests/auto/declarative/qmlgraphicsloader/tst_qmlgraphicsloader.cpp +++ /dev/null @@ -1,464 +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 <qtest.h> -#include <QtGui/QGraphicsWidget> -#include <QtGui/QGraphicsScene> - -#include <QSignalSpy> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsloader_p.h> -#include "testhttpserver.h" - -#define SERVER_PORT 14445 - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - -class tst_QmlGraphicsLoader : public QObject - -{ - Q_OBJECT -public: - tst_QmlGraphicsLoader(); - -private slots: - void url(); - void invalidUrl(); - void component(); - void clear(); - void urlToComponent(); - void componentToUrl(); - void sizeLoaderToItem(); - void sizeItemToLoader(); - void noResize(); - void sizeLoaderToGraphicsWidget(); - void sizeGraphicsWidgetToLoader(); - void noResizeGraphicsWidget(); - void networkRequestUrl(); - void failNetworkRequest(); -// void networkComponent(); - -private: - QmlEngine engine; -}; - - -tst_QmlGraphicsLoader::tst_QmlGraphicsLoader() -{ -} - -void tst_QmlGraphicsLoader::url() -{ - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->item()); - QVERIFY(loader->source() == QUrl::fromLocalFile(SRCDIR "/data/Rect120x60.qml")); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Ready); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - delete loader; -} - -void tst_QmlGraphicsLoader::component() -{ - QmlComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QVERIFY(item); - - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(item->QGraphicsObject::children().at(1)); - QVERIFY(loader); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Ready); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - delete loader; -} - -void tst_QmlGraphicsLoader::invalidUrl() -{ - QTest::ignoreMessage(QtWarningMsg, QString("(:-1: File error for URL " + QUrl::fromLocalFile(SRCDIR "/data/IDontExist.qml").toString() + ") ").toUtf8().constData()); - - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"IDontExist.qml\" }"), TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->item() == 0); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Error); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); - - delete loader; -} - -void tst_QmlGraphicsLoader::clear() -{ - { - QmlComponent component(&engine); - component.setData(QByteArray( - "import Qt 4.6\n" - " Loader { id: loader\n" - " source: 'Rect120x60.qml'\n" - " Timer { interval: 200; running: true; onTriggered: loader.source = '' }\n" - " }") - , TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - QTest::qWait(500); - - QVERIFY(loader->item() == 0); - QCOMPARE(loader->progress(), 0.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Null); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); - - delete loader; - } - { - QmlComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QVERIFY(item); - - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(item->QGraphicsObject::children().at(1)); - QVERIFY(loader); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - loader->setSourceComponent(0); - - QVERIFY(loader->item() == 0); - QCOMPARE(loader->progress(), 0.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Null); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); - - delete loader; - } -} - -void tst_QmlGraphicsLoader::urlToComponent() -{ - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\n" - "Loader {\n" - " id: loader\n" - " Component { id: myComp; Rectangle { width: 10; height: 10 } }\n" - " source: \"Rect120x60.qml\"\n" - " Timer { interval: 100; running: true; onTriggered: loader.sourceComponent = myComp }\n" - "}" ) - , TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QTest::qWait(500); - QVERIFY(loader != 0); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - QCOMPARE(loader->width(), 10.0); - QCOMPARE(loader->height(), 10.0); - - delete loader; -} - -void tst_QmlGraphicsLoader::componentToUrl() -{ - QmlComponent component(&engine, TEST_FILE("/SetSourceComponent.qml")); - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QVERIFY(item); - - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(item->QGraphicsObject::children().at(1)); - QVERIFY(loader); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - loader->setSource(TEST_FILE("/Rect120x60.qml")); - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - QCOMPARE(loader->width(), 120.0); - QCOMPARE(loader->height(), 60.0); - - delete loader; -} - -void tst_QmlGraphicsLoader::sizeLoaderToItem() -{ - QmlComponent component(&engine, TEST_FILE("/SizeToItem.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QmlGraphicsLoader::SizeLoaderToItem); - QCOMPARE(loader->width(), 120.0); - QCOMPARE(loader->height(), 60.0); - - // Check resize - QmlGraphicsItem *rect = qobject_cast<QmlGraphicsItem*>(loader->item()); - QVERIFY(rect); - rect->setWidth(150); - rect->setHeight(45); - QCOMPARE(loader->width(), 150.0); - QCOMPARE(loader->height(), 45.0); - - // Switch mode - loader->setResizeMode(QmlGraphicsLoader::SizeItemToLoader); - loader->setWidth(180); - loader->setHeight(30); - QCOMPARE(rect->width(), 180.0); - QCOMPARE(rect->height(), 30.0); - - // notify - QSignalSpy spy(loader, SIGNAL(resizeModeChanged())); - loader->setResizeMode(QmlGraphicsLoader::NoResize); - QCOMPARE(spy.count(),1); - loader->setResizeMode(QmlGraphicsLoader::NoResize); - QCOMPARE(spy.count(),1); -} - -void tst_QmlGraphicsLoader::sizeItemToLoader() -{ - QmlComponent component(&engine, TEST_FILE("/SizeToLoader.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QmlGraphicsLoader::SizeItemToLoader); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); - - QmlGraphicsItem *rect = qobject_cast<QmlGraphicsItem*>(loader->item()); - QVERIFY(rect); - QCOMPARE(rect->width(), 200.0); - QCOMPARE(rect->height(), 80.0); - - // Check resize - loader->setWidth(180); - loader->setHeight(30); - QCOMPARE(rect->width(), 180.0); - QCOMPARE(rect->height(), 30.0); - - // Switch mode - loader->setResizeMode(QmlGraphicsLoader::SizeLoaderToItem); - rect->setWidth(160); - rect->setHeight(45); - QCOMPARE(loader->width(), 160.0); - QCOMPARE(loader->height(), 45.0); -} - -void tst_QmlGraphicsLoader::noResize() -{ - QmlComponent component(&engine, TEST_FILE("/NoResize.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); - - QmlGraphicsItem *rect = qobject_cast<QmlGraphicsItem*>(loader->item()); - QVERIFY(rect); - QCOMPARE(rect->width(), 120.0); - QCOMPARE(rect->height(), 60.0); -} - -void tst_QmlGraphicsLoader::sizeLoaderToGraphicsWidget() -{ - QmlComponent component(&engine, TEST_FILE("/SizeLoaderToGraphicsWidget.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QGraphicsScene scene; - scene.addItem(loader); - - QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QmlGraphicsLoader::SizeLoaderToItem); - QCOMPARE(loader->width(), 250.0); - QCOMPARE(loader->height(), 250.0); - - // Check resize - QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); - QVERIFY(widget); - widget->resize(QSizeF(150,45)); - QCOMPARE(loader->width(), 150.0); - QCOMPARE(loader->height(), 45.0); - - // Switch mode - loader->setResizeMode(QmlGraphicsLoader::SizeItemToLoader); - loader->setWidth(180); - loader->setHeight(30); - QCOMPARE(widget->size().width(), 180.0); - QCOMPARE(widget->size().height(), 30.0); -} - -void tst_QmlGraphicsLoader::sizeGraphicsWidgetToLoader() -{ - QmlComponent component(&engine, TEST_FILE("/SizeGraphicsWidgetToLoader.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QGraphicsScene scene; - scene.addItem(loader); - - QVERIFY(loader != 0); - QVERIFY(loader->resizeMode() == QmlGraphicsLoader::SizeItemToLoader); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); - - QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); - QVERIFY(widget); - QCOMPARE(widget->size().width(), 200.0); - QCOMPARE(widget->size().height(), 80.0); - - // Check resize - loader->setWidth(180); - loader->setHeight(30); - QCOMPARE(widget->size().width(), 180.0); - QCOMPARE(widget->size().height(), 30.0); - - // Switch mode - loader->setResizeMode(QmlGraphicsLoader::SizeLoaderToItem); - widget->resize(QSizeF(160,45)); - QCOMPARE(loader->width(), 160.0); - QCOMPARE(loader->height(), 45.0); -} - -void tst_QmlGraphicsLoader::noResizeGraphicsWidget() -{ - QmlComponent component(&engine, TEST_FILE("/NoResizeGraphicsWidget.qml")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QGraphicsScene scene; - scene.addItem(loader); - - QVERIFY(loader != 0); - QCOMPARE(loader->width(), 200.0); - QCOMPARE(loader->height(), 80.0); - - QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(loader->item()); - QVERIFY(widget); - QCOMPARE(widget->size().width(), 250.0); - QCOMPARE(widget->size().height(), 250.0); -} - -void tst_QmlGraphicsLoader::networkRequestUrl() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); - - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/Rect120x60.qml\" }"), TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - - TRY_WAIT(loader->status() == QmlGraphicsLoader::Ready); - - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - delete loader; -} - -/* XXX Component waits until all dependencies are loaded. Is this actually possible? -void tst_QmlGraphicsLoader::networkComponent() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.serveDirectory("slowdata", TestHTTPServer::Delay); - - QmlComponent component(&engine); - component.setData(QByteArray( - "import Qt 4.6\n" - "import \"http://127.0.0.1:14445/\" as NW\n" - "Item {\n" - " Component { id: comp; NW.SlowRect {} }\n" - " Loader { sourceComponent: comp } }") - , TEST_FILE("")); - - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(component.create()); - QVERIFY(item); - - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(item->QGraphicsObject::children().at(1)); - QVERIFY(loader); - TRY_WAIT(loader->status() == QmlGraphicsLoader::Ready); - - QVERIFY(loader->item()); - QCOMPARE(loader->progress(), 1.0); - QCOMPARE(loader->status(), QmlGraphicsLoader::Ready); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1); - - delete loader; -} -*/ - -void tst_QmlGraphicsLoader::failNetworkRequest() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.serveDirectory(SRCDIR "/data"); - - QTest::ignoreMessage(QtWarningMsg, "(:-1: Network error for URL http://127.0.0.1:14445/IDontExist.qml) "); - - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nLoader { source: \"http://127.0.0.1:14445/IDontExist.qml\" }"), TEST_FILE("")); - QmlGraphicsLoader *loader = qobject_cast<QmlGraphicsLoader*>(component.create()); - QVERIFY(loader != 0); - - TRY_WAIT(loader->status() == QmlGraphicsLoader::Error); - - QVERIFY(loader->item() == 0); - QCOMPARE(loader->progress(), 0.0); - QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 0); - - delete loader; -} - -QTEST_MAIN(tst_QmlGraphicsLoader) - -#include "tst_qmlgraphicsloader.moc" diff --git a/tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro b/tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro deleted file mode 100644 index f85bf0f..0000000 --- a/tests/auto/declarative/qmlgraphicsmousearea/qmlgraphicsmousearea.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui network -macx:CONFIG -= app_bundle - -HEADERS += ../shared/testhttpserver.h -SOURCES += tst_qmlgraphicsmousearea.cpp ../shared/testhttpserver.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp b/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp deleted file mode 100644 index 869a7bd..0000000 --- a/tests/auto/declarative/qmlgraphicsmousearea/tst_qmlgraphicsmousearea.cpp +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 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 <QtTest/QtTest> -#include <QtTest/QSignalSpy> -#include <private/qmlgraphicsmousearea_p.h> -#include <QtDeclarative/qmlview.h> - -class tst_QmlGraphicsMouseArea: public QObject -{ - Q_OBJECT -private slots: - void dragProperties(); -private: - QmlView *createView(const QString &filename); -}; - -void tst_QmlGraphicsMouseArea::dragProperties() -{ - QmlView *canvas = createView(SRCDIR "/data/dragproperties.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsMouseArea *mouseRegion = canvas->rootObject()->findChild<QmlGraphicsMouseArea*>("mouseregion"); - QmlGraphicsDrag *drag = mouseRegion->drag(); - QVERIFY(mouseRegion != 0); - QVERIFY(drag != 0); - - // target - QmlGraphicsItem *blackRect = canvas->rootObject()->findChild<QmlGraphicsItem*>("blackrect"); - QVERIFY(blackRect != 0); - QVERIFY(blackRect == drag->target()); - QmlGraphicsItem *rootItem = qobject_cast<QmlGraphicsItem*>(canvas->rootObject()); - QVERIFY(rootItem != 0); - QSignalSpy targetSpy(drag, SIGNAL(targetChanged())); - drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); - drag->setTarget(rootItem); - QCOMPARE(targetSpy.count(),1); - - // axis - QCOMPARE(drag->axis(), QmlGraphicsDrag::XandYAxis); - QSignalSpy axisSpy(drag, SIGNAL(axisChanged())); - drag->setAxis(QmlGraphicsDrag::XAxis); - QCOMPARE(drag->axis(), QmlGraphicsDrag::XAxis); - QCOMPARE(axisSpy.count(),1); - drag->setAxis(QmlGraphicsDrag::XAxis); - QCOMPARE(axisSpy.count(),1); - - // minimum and maximum properties - QSignalSpy xminSpy(drag, SIGNAL(minimumXChanged())); - QSignalSpy xmaxSpy(drag, SIGNAL(maximumXChanged())); - QSignalSpy yminSpy(drag, SIGNAL(minimumYChanged())); - QSignalSpy ymaxSpy(drag, SIGNAL(maximumYChanged())); - - QCOMPARE(drag->xmin(), 0.0); - QCOMPARE(drag->xmax(), rootItem->width()-blackRect->width()); - QCOMPARE(drag->ymin(), 0.0); - QCOMPARE(drag->ymax(), rootItem->height()-blackRect->height()); - - drag->setXmin(10); - drag->setXmax(10); - drag->setYmin(10); - drag->setYmax(10); - - QCOMPARE(drag->xmin(), 10.0); - QCOMPARE(drag->xmax(), 10.0); - QCOMPARE(drag->ymin(), 10.0); - QCOMPARE(drag->ymax(), 10.0); - - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); - - drag->setXmin(10); - drag->setXmax(10); - drag->setYmin(10); - drag->setYmax(10); - - QCOMPARE(xminSpy.count(),1); - QCOMPARE(xmaxSpy.count(),1); - QCOMPARE(yminSpy.count(),1); - QCOMPARE(ymaxSpy.count(),1); -} - -QmlView *tst_QmlGraphicsMouseArea::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -QTEST_MAIN(tst_QmlGraphicsMouseArea) - -#include "tst_qmlgraphicsmousearea.moc" diff --git a/tests/auto/declarative/qmlgraphicsparticles/qmlgraphicsparticles.pro b/tests/auto/declarative/qmlgraphicsparticles/qmlgraphicsparticles.pro deleted file mode 100644 index 94eeb4e..0000000 --- a/tests/auto/declarative/qmlgraphicsparticles/qmlgraphicsparticles.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsparticles.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp b/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp deleted file mode 100644 index a5c0b78..0000000 --- a/tests/auto/declarative/qmlgraphicsparticles/tst_qmlgraphicsparticles.cpp +++ /dev/null @@ -1,122 +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 <QtTest/QtTest> -#include <qmlview.h> -#include <private/qmlgraphicsparticles_p.h> - -class tst_QmlGraphicsParticles : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsParticles(); - -private slots: - void properties(); - void runs(); -private: - QmlView *createView(const QString &filename); - -}; - -tst_QmlGraphicsParticles::tst_QmlGraphicsParticles() -{ -} - -void tst_QmlGraphicsParticles::properties() -{ - QmlView *canvas = createView(SRCDIR "/data/particles.qml"); - QVERIFY(canvas->rootObject()); - QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles"); - QVERIFY(particles); - - particles->setSource(QUrl::fromLocalFile(SRCDIR "/data/particle.png")); - QCOMPARE(particles->source(), QUrl::fromLocalFile(SRCDIR "/data/particle.png")); - - particles->setLifeSpanDeviation(1000); - QCOMPARE(particles->lifeSpanDeviation(), 1000); - - particles->setFadeInDuration(1000); - QCOMPARE(particles->fadeInDuration(), 1000); - - particles->setFadeOutDuration(1000); - QCOMPARE(particles->fadeOutDuration(), 1000); - - particles->setAngle(100.0); - QCOMPARE(particles->angle(), 100.0); - - particles->setAngleDeviation(100.0); - QCOMPARE(particles->angleDeviation(), 100.0); - - particles->setVelocity(100.0); - QCOMPARE(particles->velocity(), 100.0); - - particles->setVelocityDeviation(100.0); - QCOMPARE(particles->velocityDeviation(), 100.0); - - particles->setEmissionVariance(0.5); - QCOMPARE(particles->emissionVariance(),0.5); - - particles->setEmissionRate(12); - QCOMPARE(particles->emissionRate(), 12); -} - -void tst_QmlGraphicsParticles::runs() -{ - QmlView *canvas = createView(SRCDIR "/data/particles.qml"); - QVERIFY(canvas->rootObject()); - QmlGraphicsParticles* particles = canvas->rootObject()->findChild<QmlGraphicsParticles*>("particles"); - QVERIFY(particles); - QTest::qWait(1000);//Run for one second. Test passes if it doesn't crash. -} - -QmlView *tst_QmlGraphicsParticles::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - canvas->execute(); - - return canvas; -} -QTEST_MAIN(tst_QmlGraphicsParticles) - -#include "tst_qmlgraphicsparticles.moc" diff --git a/tests/auto/declarative/qmlgraphicspathview/qmlgraphicspathview.pro b/tests/auto/declarative/qmlgraphicspathview/qmlgraphicspathview.pro deleted file mode 100644 index 142a256..0000000 --- a/tests/auto/declarative/qmlgraphicspathview/qmlgraphicspathview.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicspathview.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp b/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp deleted file mode 100644 index b986a64..0000000 --- a/tests/auto/declarative/qmlgraphicspathview/tst_qmlgraphicspathview.cpp +++ /dev/null @@ -1,491 +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 <private/qmlgraphicspathview_p.h> -#include <private/qmlgraphicspath_p.h> -#include <qmlcontext.h> -#include <qmlexpression.h> -#include <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlview.h> -#include <QtDeclarative/private/qmlgraphicstext_p.h> -#include <QtDeclarative/private/qmlgraphicsrectangle_p.h> -#include <QAbstractListModel> -#include <QFile> -#include <private/qmlvaluetype_p.h> -#include "../../../shared/util.h" - -class tst_QmlGraphicsPathView : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsPathView(); - -private slots: - void initValues(); - void items(); - void dataModel(); - void pathview2(); - void pathview3(); - void path(); - void pathMoved(); - -private: - QmlView *createView(const QString &filename); - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &objectName, int index=-1); - template<typename T> - QList<T*> findItems(QGraphicsObject *parent, const QString &objectName); -}; - -class TestObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool error READ error WRITE setError) - Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged) - Q_PROPERTY(int pathItemCount READ pathItemCount NOTIFY pathItemCountChanged) - -public: - TestObject() : QObject(), mError(true), mUseModel(true), mPathItemCount(-1) {} - - bool error() const { return mError; } - void setError(bool err) { mError = err; } - - bool useModel() const { return mUseModel; } - void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); } - - int pathItemCount() const { return mPathItemCount; } - void setPathItemCount(int count) { mPathItemCount = count; emit pathItemCountChanged(); } - -signals: - void useModelChanged(); - void pathItemCountChanged(); - -private: - bool mError; - bool mUseModel; - int mPathItemCount; -}; - -class TestModel : public QAbstractListModel -{ -public: - enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; - - TestModel(QObject *parent=0) : QAbstractListModel(parent) { - QHash<int, QByteArray> roles; - roles[Name] = "name"; - roles[Number] = "number"; - setRoleNames(roles); - } - - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { - QVariant rv; - if (role == Name) - rv = list.at(index.row()).first; - else if (role == Number) - rv = list.at(index.row()).second; - - return rv; - } - - int count() const { return rowCount(); } - QString name(int index) const { return list.at(index).first; } - QString number(int index) const { return list.at(index).second; } - - void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); - list.append(QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); - list.insert(index, QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); - list.removeAt(index); - emit endRemoveRows(); - } - - void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); - list.move(from, to); - emit endMoveRows(); - } - - void modifyItem(int idx, const QString &name, const QString &number) { - list[idx] = QPair<QString,QString>(name, number); - emit dataChanged(index(idx,0), index(idx,0)); - } - -private: - QList<QPair<QString,QString> > list; -}; - - -tst_QmlGraphicsPathView::tst_QmlGraphicsPathView() -{ -} - -void tst_QmlGraphicsPathView::initValues() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview1.qml")); - QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->path() == 0); - QVERIFY(obj->delegate() == 0); - QCOMPARE(obj->model(), QVariant()); - QCOMPARE(obj->currentIndex(), 0); - QCOMPARE(obj->offset(), 0.); - QCOMPARE(obj->snapPosition(), 0.); - QCOMPARE(obj->dragMargin(), 0.); - QCOMPARE(obj->count(), 0); - QCOMPARE(obj->pathItemCount(), -1); -} - -void tst_QmlGraphicsPathView::items() -{ - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); - - TestModel model; - model.addItem("Fred", "12345"); - model.addItem("John", "2345"); - model.addItem("Bob", "54321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view"); - QVERIFY(pathview != 0); - - QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible - - for (int i = 0; i < model.count(); ++i) { - QmlGraphicsText *name = findItem<QmlGraphicsText>(pathview, "textName", i); - QVERIFY(name != 0); - QCOMPARE(name->text(), model.name(i)); - QmlGraphicsText *number = findItem<QmlGraphicsText>(pathview, "textNumber", i); - QVERIFY(number != 0); - QCOMPARE(number->text(), model.number(i)); - } - - delete canvas; -} - -void tst_QmlGraphicsPathView::pathview2() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview2.qml")); - QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); - QVERIFY(obj->model() != QVariant()); - QCOMPARE(obj->currentIndex(), 0); - QCOMPARE(obj->offset(), 0.); - QCOMPARE(obj->snapPosition(), 0.); - QCOMPARE(obj->dragMargin(), 0.); - QCOMPARE(obj->count(), 8); - QCOMPARE(obj->pathItemCount(), 10); -} - -void tst_QmlGraphicsPathView::pathview3() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/pathview3.qml")); - QmlGraphicsPathView *obj = qobject_cast<QmlGraphicsPathView*>(c.create()); - - QVERIFY(obj != 0); - QVERIFY(obj->path() != 0); - QVERIFY(obj->delegate() != 0); - QVERIFY(obj->model() != QVariant()); - QCOMPARE(obj->currentIndex(), 0); - QCOMPARE(obj->offset(), 50.); // ??? - QCOMPARE(obj->snapPosition(), 0.5); // ??? - QCOMPARE(obj->dragMargin(), 24.); - QCOMPARE(obj->count(), 8); - QCOMPARE(obj->pathItemCount(), 4); -} - -void tst_QmlGraphicsPathView::path() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/path.qml")); - QmlGraphicsPath *obj = qobject_cast<QmlGraphicsPath*>(c.create()); - - QVERIFY(obj != 0); - QCOMPARE(obj->startX(), 120.); - QCOMPARE(obj->startY(), 100.); - QVERIFY(obj->path() != QPainterPath()); - - QmlListReference list(obj, "pathElements"); - QCOMPARE(list.count(), 5); - - QmlGraphicsPathAttribute* attr = qobject_cast<QmlGraphicsPathAttribute*>(list.at(0)); - QVERIFY(attr != 0); - QCOMPARE(attr->name(), QString("scale")); - QCOMPARE(attr->value(), 1.0); - - QmlGraphicsPathQuad* quad = qobject_cast<QmlGraphicsPathQuad*>(list.at(1)); - QVERIFY(quad != 0); - QCOMPARE(quad->x(), 120.); - QCOMPARE(quad->y(), 25.); - QCOMPARE(quad->controlX(), 260.); - QCOMPARE(quad->controlY(), 75.); - - QmlGraphicsPathPercent* perc = qobject_cast<QmlGraphicsPathPercent*>(list.at(2)); - QVERIFY(perc != 0); - QCOMPARE(perc->value(), 0.3); - - QmlGraphicsPathLine* line = qobject_cast<QmlGraphicsPathLine*>(list.at(3)); - QVERIFY(line != 0); - QCOMPARE(line->x(), 120.); - QCOMPARE(line->y(), 100.); - - QmlGraphicsPathCubic* cubic = qobject_cast<QmlGraphicsPathCubic*>(list.at(4)); - QVERIFY(cubic != 0); - QCOMPARE(cubic->x(), 180.); - QCOMPARE(cubic->y(), 0.); - QCOMPARE(cubic->control1X(), -10.); - QCOMPARE(cubic->control1Y(), 90.); - QCOMPARE(cubic->control2X(), 210.); - QCOMPARE(cubic->control2Y(), 90.); -} - -void tst_QmlGraphicsPathView::dataModel() -{ - QmlView *canvas = createView(SRCDIR "/data/datamodel.qml"); - - QmlContext *ctxt = canvas->rootContext(); - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - TestModel model; - model.addItem("red", "1"); - model.addItem("green", "2"); - model.addItem("blue", "3"); - model.addItem("purple", "4"); - model.addItem("gray", "5"); - model.addItem("brown", "6"); - model.addItem("yellow", "7"); - model.addItem("thistle", "8"); - model.addItem("cyan", "9"); - - ctxt->setContextProperty("testData", &model); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsPathView *pathview = qobject_cast<QmlGraphicsPathView*>(canvas->rootObject()); - QVERIFY(pathview != 0); - - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - - QmlGraphicsItem *item = findItem<QmlGraphicsItem>(pathview, "wrapper", 0); - QVERIFY(item); - QCOMPARE(item->x(), 110.0); - QCOMPARE(item->y(), 10.0); - - model.insertItem(4, "orange", "10"); - - int itemCount = findItems<QmlGraphicsItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 10); - - QmlGraphicsText *text = findItem<QmlGraphicsText>(pathview, "myText", 4); - QVERIFY(text); - QCOMPARE(text->text(), model.name(4)); - - model.removeItem(2); - text = findItem<QmlGraphicsText>(pathview, "myText", 2); - QVERIFY(text); - QCOMPARE(text->text(), model.name(2)); - - testObject->setPathItemCount(5); - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - - itemCount = findItems<QmlGraphicsItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); - - QmlGraphicsRectangle *testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 4); - QVERIFY(testItem != 0); - testItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 5); - QVERIFY(testItem == 0); - - model.insertItem(2, "pink", "2"); - - itemCount = findItems<QmlGraphicsItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); - - text = findItem<QmlGraphicsText>(pathview, "myText", 2); - QVERIFY(text); - QCOMPARE(text->text(), model.name(2)); - - model.removeItem(3); - itemCount = findItems<QmlGraphicsItem>(pathview, "wrapper").count(); - QCOMPARE(itemCount, 5); - text = findItem<QmlGraphicsText>(pathview, "myText", 3); - QVERIFY(text); - QCOMPARE(text->text(), model.name(3)); - - delete canvas; -} - -void tst_QmlGraphicsPathView::pathMoved() -{ - QmlView *canvas = createView(SRCDIR "/data/pathview.qml"); - - TestModel model; - model.addItem("Ben", "12345"); - model.addItem("Bohn", "2345"); - model.addItem("Bob", "54321"); - model.addItem("Bill", "4321"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testModel", &model); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsPathView *pathview = findItem<QmlGraphicsPathView>(canvas->rootObject(), "view"); - QVERIFY(pathview != 0); - - QmlGraphicsRectangle *firstItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", 0); - QVERIFY(firstItem); - QmlGraphicsPath *path = qobject_cast<QmlGraphicsPath*>(pathview->path()); - QVERIFY(path); - QPointF start = path->pointAt(0.0); - QPointF offset;//Center of item is at point, but pos is from corner - offset.setX(firstItem->width()/2); - offset.setY(firstItem->height()/2); - QCOMPARE(firstItem->pos() + offset, start); - pathview->setOffset(10); - QTest::qWait(1000);//Moving is animated? - - for(int i=0; i<model.count(); i++){ - QmlGraphicsRectangle *curItem = findItem<QmlGraphicsRectangle>(pathview, "wrapper", i); - QCOMPARE(curItem->pos() + offset, path->pointAt(0.1 + i*0.25)); - } - - pathview->setOffset(100); - QTest::qWait(1000);//Moving is animated? - QCOMPARE(firstItem->pos() + offset, start); - - delete canvas; -} - -QmlView *tst_QmlGraphicsPathView::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -/* - Find an item with the specified objectName. If index is supplied then the - item must also evaluate the {index} expression equal to index - */ -template<typename T> -T *tst_QmlGraphicsPathView::findItem(QGraphicsObject *parent, const QString &objectName, int index) -{ - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->childItems().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) { - if (index != -1) { - QmlExpression e(qmlContext(item), "index", item); - e.setTrackChange(false); - if (e.value().toInt() == index) - return static_cast<T*>(item); - } else { - return static_cast<T*>(item); - } - } - item = findItem<T>(item, objectName, index); - if (item) - return static_cast<T*>(item); - } - - return 0; -} - -template<typename T> -QList<T*> tst_QmlGraphicsPathView::findItems(QGraphicsObject *parent, const QString &objectName) -{ - QList<T*> items; - const QMetaObject &mo = T::staticMetaObject; - //qDebug() << parent->QGraphicsObject::children().count() << "children"; - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if(!item) - continue; - //qDebug() << "try" << item; - if (mo.cast(item) && (objectName.isEmpty() || item->objectName() == objectName)) - items.append(static_cast<T*>(item)); - items += findItems<T>(item, objectName); - } - - return items; -} - -QTEST_MAIN(tst_QmlGraphicsPathView) - -#include "tst_qmlgraphicspathview.moc" diff --git a/tests/auto/declarative/qmlgraphicspositioners/qmlgraphicspositioners.pro b/tests/auto/declarative/qmlgraphicspositioners/qmlgraphicspositioners.pro deleted file mode 100644 index d151026..0000000 --- a/tests/auto/declarative/qmlgraphicspositioners/qmlgraphicspositioners.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlgraphicspositioners.cpp -macx:CONFIG -= app_bundle - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp b/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp deleted file mode 100644 index b51266a..0000000 --- a/tests/auto/declarative/qmlgraphicspositioners/tst_qmlgraphicspositioners.cpp +++ /dev/null @@ -1,417 +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 <QtTest/QtTest> -#include <private/qlistmodelinterface_p.h> -#include <qmlview.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <qmlexpression.h> -#include "../../../shared/util.h" - -class tst_QmlGraphicsPositioners : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsPositioners(); - -private slots: - void test_horizontal(); - void test_horizontal_spacing(); - void test_horizontal_animated(); - void test_vertical(); - void test_vertical_spacing(); - void test_vertical_animated(); - void test_grid(); - void test_grid_spacing(); - void test_grid_animated(); - - void test_repeater(); -private: - QmlView *createView(const QString &filename); -}; - -tst_QmlGraphicsPositioners::tst_QmlGraphicsPositioners() -{ -} - -void tst_QmlGraphicsPositioners::test_horizontal() -{ - QmlView *canvas = createView(SRCDIR "/data/horizontal.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 50.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 70.0); - QCOMPARE(three->y(), 0.0); -} - -void tst_QmlGraphicsPositioners::test_horizontal_spacing() -{ - QmlView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 60.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 90.0); - QCOMPARE(three->y(), 0.0); -} - -void tst_QmlGraphicsPositioners::test_horizontal_animated() -{ - QmlView *canvas = createView(SRCDIR "/data/horizontal-animated.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - //Note that they animate in - QCOMPARE(one->x(), -100.0); - QCOMPARE(two->x(), -100.0); - QCOMPARE(three->x(), -100.0); - - //QTRY_COMPARE used instead of waiting for the expected time of animation completion - //Note that this means the duration of the animation is NOT tested - - QTRY_COMPARE(one->x(), 0.0); - QTRY_COMPARE(one->y(), 0.0); - QTRY_COMPARE(two->opacity(), 0.0); - QTRY_COMPARE(two->x(), -100.0);//Not 'in' yet - QTRY_COMPARE(two->y(), 0.0); - QTRY_COMPARE(three->x(), 50.0); - QTRY_COMPARE(three->y(), 0.0); - - //Add 'two' - two->setOpacity(1.0); - QCOMPARE(two->opacity(), 1.0); - QTest::qWait(0);//Let the animation start - QCOMPARE(two->x(), -100.0); - QCOMPARE(three->x(), 50.0); - - QTRY_COMPARE(two->x(), 50.0); - QTRY_COMPARE(three->x(), 100.0); -} - -void tst_QmlGraphicsPositioners::test_vertical() -{ - QmlView *canvas = createView(SRCDIR "/data/vertical.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 0.0); - QCOMPARE(two->y(), 50.0); - QCOMPARE(three->x(), 0.0); - QCOMPARE(three->y(), 60.0); -} - -void tst_QmlGraphicsPositioners::test_vertical_spacing() -{ - QmlView *canvas = createView(SRCDIR "/data/vertical-spacing.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 0.0); - QCOMPARE(two->y(), 60.0); - QCOMPARE(three->x(), 0.0); - QCOMPARE(three->y(), 80.0); -} - -void tst_QmlGraphicsPositioners::test_vertical_animated() -{ - QmlView *canvas = createView(SRCDIR "/data/vertical-animated.qml"); - - canvas->execute(); - - //Note that they animate in - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - QCOMPARE(one->y(), -100.0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - QCOMPARE(two->y(), -100.0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - QCOMPARE(three->y(), -100.0); - - //QTRY_COMPARE used instead of waiting for the expected time of animation completion - //Note that this means the duration of the animation is NOT tested - - QTRY_COMPARE(one->y(), 0.0); - QTRY_COMPARE(one->x(), 0.0); - QTRY_COMPARE(two->opacity(), 0.0); - QTRY_COMPARE(two->y(), -100.0);//Not 'in' yet - QTRY_COMPARE(two->x(), 0.0); - QTRY_COMPARE(three->y(), 50.0); - QTRY_COMPARE(three->x(), 0.0); - - //Add 'two' - two->setOpacity(1.0); - QTRY_COMPARE(two->opacity(), 1.0); - QTest::qWait(0);//Let the animation start - QCOMPARE(two->y(), -100.0); - QCOMPARE(three->y(), 50.0); - - QTRY_COMPARE(two->y(), 50.0); - QTRY_COMPARE(three->y(), 100.0); - -} - -void tst_QmlGraphicsPositioners::test_grid() -{ - QmlView *canvas = createView("data/grid.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four"); - QVERIFY(four != 0); - QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five"); - QVERIFY(five != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 50.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 70.0); - QCOMPARE(three->y(), 0.0); - QCOMPARE(four->x(), 0.0); - QCOMPARE(four->y(), 50.0); - QCOMPARE(five->x(), 50.0); - QCOMPARE(five->y(), 50.0); -} - -void tst_QmlGraphicsPositioners::test_grid_spacing() -{ - QmlView *canvas = createView("data/grid-spacing.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four"); - QVERIFY(four != 0); - QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five"); - QVERIFY(five != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 54.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 78.0); - QCOMPARE(three->y(), 0.0); - QCOMPARE(four->x(), 0.0); - QCOMPARE(four->y(), 54.0); - QCOMPARE(five->x(), 54.0); - QCOMPARE(five->y(), 54.0); -} - -void tst_QmlGraphicsPositioners::test_grid_animated() -{ - QmlView *canvas = createView(SRCDIR "/data/grid-animated.qml"); - canvas->execute(); - - //Note that all animate in - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - QCOMPARE(one->x(), -100.0); - QCOMPARE(one->y(), -100.0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - QCOMPARE(two->x(), -100.0); - QCOMPARE(two->y(), -100.0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - QCOMPARE(three->x(), -100.0); - QCOMPARE(three->y(), -100.0); - - QmlGraphicsRectangle *four = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("four"); - QVERIFY(four != 0); - QCOMPARE(four->x(), -100.0); - QCOMPARE(four->y(), -100.0); - - QmlGraphicsRectangle *five = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("five"); - QVERIFY(five != 0); - QCOMPARE(five->x(), -100.0); - QCOMPARE(five->y(), -100.0); - - //QTRY_COMPARE used instead of waiting for the expected time of animation completion - //Note that this means the duration of the animation is NOT tested - - QTRY_COMPARE(one->y(), 0.0); - QTRY_COMPARE(one->x(), 0.0); - QTRY_COMPARE(two->opacity(), 0.0); - QTRY_COMPARE(two->y(), -100.0); - QTRY_COMPARE(two->x(), -100.0); - QTRY_COMPARE(three->y(), 0.0); - QTRY_COMPARE(three->x(), 50.0); - QTRY_COMPARE(four->y(), 0.0); - QTRY_COMPARE(four->x(), 100.0); - QTRY_COMPARE(five->y(), 50.0); - QTRY_COMPARE(five->x(), 0.0); - - //Add 'two' - two->setOpacity(1.0); - QCOMPARE(two->opacity(), 1.0); - QTest::qWait(0);//Let the animation start - QCOMPARE(two->x(), -100.0); - QCOMPARE(two->y(), -100.0); - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(three->x(), 50.0); - QCOMPARE(three->y(), 0.0); - QCOMPARE(four->x(), 100.0); - QCOMPARE(four->y(), 0.0); - QCOMPARE(five->x(), 0.0); - QCOMPARE(five->y(), 50.0); - //Let the animation complete - QTRY_COMPARE(two->x(), 50.0); - QTRY_COMPARE(two->y(), 0.0); - QTRY_COMPARE(one->x(), 0.0); - QTRY_COMPARE(one->y(), 0.0); - QTRY_COMPARE(three->x(), 100.0); - QTRY_COMPARE(three->y(), 0.0); - QTRY_COMPARE(four->x(), 0.0); - QTRY_COMPARE(four->y(), 50.0); - QTRY_COMPARE(five->x(), 50.0); - QTRY_COMPARE(five->y(), 50.0); - -} - -void tst_QmlGraphicsPositioners::test_repeater() -{ - QmlView *canvas = createView("data/repeater.qml"); - - canvas->execute(); - - QmlGraphicsRectangle *one = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("one"); - QVERIFY(one != 0); - - QmlGraphicsRectangle *two = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("two"); - QVERIFY(two != 0); - - QmlGraphicsRectangle *three = canvas->rootObject()->findChild<QmlGraphicsRectangle*>("three"); - QVERIFY(three != 0); - - QCOMPARE(one->x(), 0.0); - QCOMPARE(one->y(), 0.0); - QCOMPARE(two->x(), 50.0); - QCOMPARE(two->y(), 0.0); - QCOMPARE(three->x(), 100.0); - QCOMPARE(three->y(), 0.0); -} - -QmlView *tst_QmlGraphicsPositioners::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - - -QTEST_MAIN(tst_QmlGraphicsPositioners) - -#include "tst_qmlgraphicspositioners.moc" diff --git a/tests/auto/declarative/qmlgraphicsrepeater/qmlgraphicsrepeater.pro b/tests/auto/declarative/qmlgraphicsrepeater/qmlgraphicsrepeater.pro deleted file mode 100644 index 0a10ec6..0000000 --- a/tests/auto/declarative/qmlgraphicsrepeater/qmlgraphicsrepeater.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicsrepeater.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp b/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp deleted file mode 100644 index c971840..0000000 --- a/tests/auto/declarative/qmlgraphicsrepeater/tst_qmlgraphicsrepeater.cpp +++ /dev/null @@ -1,387 +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 <QtTest/QtTest> -#include <QtTest/QSignalSpy> -#include <private/qlistmodelinterface_p.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlview.h> -#include <QtDeclarative/qmlcontext.h> -#include <private/qmlgraphicsrepeater_p.h> -#include <private/qmlgraphicstext_p.h> - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -class tst_QmlGraphicsRepeater : public QObject -{ - Q_OBJECT -public: - tst_QmlGraphicsRepeater(); - -private slots: - void numberModel(); - void objectList(); - void stringList(); - void dataModel(); - void itemModel(); - void properties(); - -private: - QmlView *createView(const QString &filename); - template<typename T> - T *findItem(QGraphicsObject *parent, const QString &id); -}; - -class TestObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(bool error READ error WRITE setError) - Q_PROPERTY(bool useModel READ useModel NOTIFY useModelChanged) - -public: - TestObject() : QObject(), mError(true), mUseModel(false) {} - - bool error() const { return mError; } - void setError(bool err) { mError = err; } - - bool useModel() const { return mUseModel; } - void setUseModel(bool use) { mUseModel = use; emit useModelChanged(); } - -signals: - void useModelChanged(); - -private: - bool mError; - bool mUseModel; -}; - -class TestModel : public QAbstractListModel -{ -public: - enum Roles { Name = Qt::UserRole+1, Number = Qt::UserRole+2 }; - - TestModel(QObject *parent=0) : QAbstractListModel(parent) { - QHash<int, QByteArray> roles; - roles[Name] = "name"; - roles[Number] = "number"; - setRoleNames(roles); - } - - int rowCount(const QModelIndex &parent=QModelIndex()) const { return list.count(); } - QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const { - QVariant rv; - if (role == Name) - rv = list.at(index.row()).first; - else if (role == Number) - rv = list.at(index.row()).second; - - return rv; - } - - int count() const { return rowCount(); } - QString name(int index) const { return list.at(index).first; } - QString number(int index) const { return list.at(index).second; } - - void addItem(const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), list.count(), list.count()); - list.append(QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void insertItem(int index, const QString &name, const QString &number) { - emit beginInsertRows(QModelIndex(), index, index); - list.insert(index, QPair<QString,QString>(name, number)); - emit endInsertRows(); - } - - void removeItem(int index) { - emit beginRemoveRows(QModelIndex(), index, index); - list.removeAt(index); - emit endRemoveRows(); - } - - void moveItem(int from, int to) { - emit beginMoveRows(QModelIndex(), from, from, QModelIndex(), to); - list.move(from, to); - emit endMoveRows(); - } - - void modifyItem(int idx, const QString &name, const QString &number) { - list[idx] = QPair<QString,QString>(name, number); - emit dataChanged(index(idx,0), index(idx,0)); - } - -private: - QList<QPair<QString,QString> > list; -}; - - -tst_QmlGraphicsRepeater::tst_QmlGraphicsRepeater() -{ -} - -void tst_QmlGraphicsRepeater::numberModel() -{ - QmlView *canvas = createView(SRCDIR "/data/intmodel.qml"); - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testData", 5); - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); - QVERIFY(repeater != 0); - QCOMPARE(repeater->parentItem()->childItems().count(), 5+1); - - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - - delete canvas; -} - -void tst_QmlGraphicsRepeater::objectList() -{ - QmlView *canvas = createView(SRCDIR "/data/objlist.qml"); - - QObjectList data; - for(int i=0; i<100; i++){ - data << new QObject(); - data.back()->setProperty("idx", i); - } - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testData", QVariant::fromValue(data)); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); - QVERIFY(repeater != 0); - QCOMPARE(repeater->property("errors").toInt(), 0);//If this fails either they are out of order or can't find the object's data - QCOMPARE(repeater->property("instantiated").toInt(), 100); -} - -/* -The Repeater element creates children at its own position in its parent's -stacking order. In this test we insert a repeater between two other Text -elements to test this. -*/ -void tst_QmlGraphicsRepeater::stringList() -{ - QmlView *canvas = createView(SRCDIR "/data/repeater.qml"); - - QStringList data; - data << "One"; - data << "Two"; - data << "Three"; - data << "Four"; - - QmlContext *ctxt = canvas->rootContext(); - ctxt->setContextProperty("testData", data); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); - QVERIFY(repeater != 0); - - QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container"); - QVERIFY(container != 0); - - QCOMPARE(container->childItems().count(), data.count() + 3); - - bool saw_repeater = false; - for (int i = 0; i < container->childItems().count(); ++i) { - - if (i == 0) { - QmlGraphicsText *name = qobject_cast<QmlGraphicsText*>(container->childItems().at(i)); - QVERIFY(name != 0); - QCOMPARE(name->text(), QLatin1String("Zero")); - } else if (i == container->childItems().count() - 2) { - // The repeater itself - QmlGraphicsRepeater *rep = qobject_cast<QmlGraphicsRepeater*>(container->childItems().at(i)); - QCOMPARE(rep, repeater); - saw_repeater = true; - continue; - } else if (i == container->childItems().count() - 1) { - QmlGraphicsText *name = qobject_cast<QmlGraphicsText*>(container->childItems().at(i)); - QVERIFY(name != 0); - QCOMPARE(name->text(), QLatin1String("Last")); - } else { - QmlGraphicsText *name = qobject_cast<QmlGraphicsText*>(container->childItems().at(i)); - QVERIFY(name != 0); - QCOMPARE(name->text(), data.at(i-1)); - } - } - QVERIFY(saw_repeater); - - delete canvas; -} - -void tst_QmlGraphicsRepeater::dataModel() -{ - QmlView *canvas = createView(SRCDIR "/data/repeater2.qml"); - QmlContext *ctxt = canvas->rootContext(); - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - TestModel testModel; - testModel.addItem("one", "1"); - testModel.addItem("two", "2"); - testModel.addItem("three", "3"); - - ctxt->setContextProperty("testData", &testModel); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); - QVERIFY(repeater != 0); - - QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container"); - QVERIFY(container != 0); - - QCOMPARE(container->childItems().count(), 4); - - testModel.addItem("four", "4"); - QCOMPARE(container->childItems().count(), 5); - - testModel.removeItem(2); - QCOMPARE(container->childItems().count(), 4); -} - -void tst_QmlGraphicsRepeater::itemModel() -{ - QmlView *canvas = createView(SRCDIR "/data/itemlist.qml"); - QmlContext *ctxt = canvas->rootContext(); - TestObject *testObject = new TestObject; - ctxt->setContextProperty("testObject", testObject); - - canvas->execute(); - qApp->processEvents(); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(canvas->rootObject(), "repeater"); - QVERIFY(repeater != 0); - - QmlGraphicsItem *container = findItem<QmlGraphicsItem>(canvas->rootObject(), "container"); - QVERIFY(container != 0); - - QCOMPARE(container->childItems().count(), 1); - - testObject->setUseModel(true); - QMetaObject::invokeMethod(canvas->rootObject(), "checkProperties"); - QVERIFY(testObject->error() == false); - - QCOMPARE(container->childItems().count(), 4); - QVERIFY(qobject_cast<QObject*>(container->childItems().at(0))->objectName() == "item1"); - QVERIFY(qobject_cast<QObject*>(container->childItems().at(1))->objectName() == "item2"); - QVERIFY(qobject_cast<QObject*>(container->childItems().at(2))->objectName() == "item3"); - QVERIFY(container->childItems().at(3) == repeater); - - delete canvas; -} - -void tst_QmlGraphicsRepeater::properties() -{ - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("/properties.qml")); - - QmlGraphicsItem *rootObject = qobject_cast<QmlGraphicsItem*>(component.create()); - QVERIFY(rootObject); - - QmlGraphicsRepeater *repeater = findItem<QmlGraphicsRepeater>(rootObject, "repeater"); - QVERIFY(repeater); - - QSignalSpy modelSpy(repeater, SIGNAL(modelChanged())); - repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); - repeater->setModel(3); - QCOMPARE(modelSpy.count(),1); - - QSignalSpy delegateSpy(repeater, SIGNAL(delegateChanged())); - - QmlComponent rectComponent(&engine); - rectComponent.setData("import Qt 4.6; Rectangle {}", QUrl::fromLocalFile("")); - - repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); - repeater->setDelegate(&rectComponent); - QCOMPARE(delegateSpy.count(),1); -} - -QmlView *tst_QmlGraphicsRepeater::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - canvas->setFixedSize(240,320); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -template<typename T> -T *tst_QmlGraphicsRepeater::findItem(QGraphicsObject *parent, const QString &objectName) -{ - const QMetaObject &mo = T::staticMetaObject; - if (mo.cast(parent) && (objectName.isEmpty() || parent->objectName() == objectName)) - return static_cast<T*>(parent); - for (int i = 0; i < parent->childItems().count(); ++i) { - QmlGraphicsItem *child = qobject_cast<QmlGraphicsItem*>(parent->childItems().at(i)); - if (!child) - continue; - QmlGraphicsItem *item = findItem<T>(child, objectName); - if (item) - return static_cast<T*>(item); - } - - return 0; -} - -QTEST_MAIN(tst_QmlGraphicsRepeater) - -#include "tst_qmlgraphicsrepeater.moc" diff --git a/tests/auto/declarative/qmlgraphicstext/qmlgraphicstext.pro b/tests/auto/declarative/qmlgraphicstext/qmlgraphicstext.pro deleted file mode 100644 index 1d8c59f..0000000 --- a/tests/auto/declarative/qmlgraphicstext/qmlgraphicstext.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicstext.cpp diff --git a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp b/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp deleted file mode 100644 index 2c1e09b..0000000 --- a/tests/auto/declarative/qmlgraphicstext/tst_qmlgraphicstext.cpp +++ /dev/null @@ -1,844 +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 <qtest.h> -#include <QTextDocument> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicstext_p.h> -#include <private/qmlvaluetype_p.h> -#include <QFontMetrics> -#include <QGraphicsSceneMouseEvent> -#include <qmath.h> - -class tst_qmlgraphicstext : public QObject - -{ - Q_OBJECT -public: - tst_qmlgraphicstext(); - -private slots: - void text(); - void width(); - void wrap(); - void elide(); - void textFormat(); - - // ### these tests may be trivial - void horizontalAlignment(); - void verticalAlignment(); - void font(); - void style(); - void color(); - void smooth(); - - // QmlFontValueType - void weight(); - void underline(); - void overline(); - void strikeout(); - void capitalization(); - void letterSpacing(); - void wordSpacing(); - - void clickLink(); - -private: - QStringList standard; - QStringList richText; - - QStringList horizontalAlignmentmentStrings; - QStringList verticalAlignmentmentStrings; - - QList<Qt::Alignment> verticalAlignmentments; - QList<Qt::Alignment> horizontalAlignmentments; - - QStringList styleStrings; - QList<QmlGraphicsText::TextStyle> styles; - - QStringList colorStrings; - - QmlEngine engine; -}; - -tst_qmlgraphicstext::tst_qmlgraphicstext() -{ - standard << "the quick brown fox jumped over the lazy dog" - << "the quick brown fox\n jumped over the lazy dog"; - - richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>" - << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>"; - - horizontalAlignmentmentStrings << "AlignLeft" - << "AlignRight" - << "AlignHCenter"; - - verticalAlignmentmentStrings << "AlignTop" - << "AlignBottom" - << "AlignVCenter"; - - horizontalAlignmentments << Qt::AlignLeft - << Qt::AlignRight - << Qt::AlignHCenter; - - verticalAlignmentments << Qt::AlignTop - << Qt::AlignBottom - << Qt::AlignVCenter; - - styleStrings << "Normal" - << "Outline" - << "Raised" - << "Sunken"; - - styles << QmlGraphicsText::Normal - << QmlGraphicsText::Outline - << QmlGraphicsText::Raised - << QmlGraphicsText::Sunken; - - colorStrings << "aliceblue" - << "antiquewhite" - << "aqua" - << "darkkhaki" - << "darkolivegreen" - << "dimgray" - << "palevioletred" - << "lightsteelblue" - << "#000000" - << "#AAAAAA" - << "#FFFFFF" - << "#2AC05F"; - // - // need a different test to do alpha channel test - // << "#AA0011DD" - // << "#00F16B11"; - // -} - -void tst_qmlgraphicstext::text() -{ - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->text(), QString("")); - QVERIFY(textObject->width() == 0); - - delete textObject; - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->text(), standard.at(i)); - QVERIFY(textObject->width() > 0); - } - - for (int i = 0; i < richText.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QString expected = richText.at(i); - QCOMPARE(textObject->text(), expected.replace("\\\"", "\"")); - QVERIFY(textObject->width() > 0); - } -} - -void tst_qmlgraphicstext::width() -{ - // uses Font metrics to find the width for standard and document to find the width for rich - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"\" }", QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->width(), 0.); - } - - for (int i = 0; i < standard.size(); i++) - { - QVERIFY(!Qt::mightBeRichText(standard.at(i))); // self-test - - QFont f; - QFontMetricsF fm(f); - qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); - metricWidth = qCeil(metricWidth); - - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->width(), qreal(metricWidth)); - QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format - } - - for (int i = 0; i < richText.size(); i++) - { - QVERIFY(Qt::mightBeRichText(richText.at(i))); // self-test - - QTextDocument document; - document.setHtml(richText.at(i)); - document.setDocumentMargin(0); - - int documentWidth = document.idealWidth(); - - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->width(), qreal(documentWidth)); - QVERIFY(textObject->textFormat() == QmlGraphicsText::AutoText); // setting text doesn't change format - } -} - -void tst_qmlgraphicstext::wrap() -{ - int textHeight = 0; - // for specified width and wrap set true - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; wrap: true; width: 300 }", QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - textHeight = textObject->height(); - - QVERIFY(textObject != 0); - QVERIFY(textObject->wrap() == true); - QCOMPARE(textObject->width(), 300.); - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->width(), 30.); - QVERIFY(textObject->height() > textHeight); - - int oldHeight = textObject->height(); - textObject->setWidth(100); - QVERIFY(textObject->height() < oldHeight); - } - - for (int i = 0; i < richText.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { wrap: true; width: 30; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->width(), 30.); - QVERIFY(textObject->height() > textHeight); - } - -} - -void tst_qmlgraphicstext::elide() -{ - for (QmlGraphicsText::TextElideMode m = QmlGraphicsText::ElideLeft; m<=QmlGraphicsText::ElideNone; m=QmlGraphicsText::TextElideMode(int(m)+1)) { - const char* elidename[]={"ElideLeft", "ElideRight", "ElideMiddle", "ElideNone"}; - QString elide = "elide: Text." + QString(elidename[int(m)]) + ";"; - - // XXX Poor coverage. - - { - QmlComponent textComponent(&engine); - textComponent.setData(("import Qt 4.6\nText { text: \"\"; "+elide+" width: 100 }").toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->elideMode(), m); - QCOMPARE(textObject->width(), 100.); - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->elideMode(), m); - QCOMPARE(textObject->width(), 100.); - } - - // richtext - does nothing - for (int i = 0; i < richText.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { "+elide+" width: 100; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->elideMode(), m); - QCOMPARE(textObject->width(), 100.); - } - } -} - -void tst_qmlgraphicstext::textFormat() -{ - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QVERIFY(textObject->textFormat() == QmlGraphicsText::RichText); - } - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nText { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QVERIFY(textObject->textFormat() == QmlGraphicsText::PlainText); - } -} - -//the alignment tests may be trivial o.oa -void tst_qmlgraphicstext::horizontalAlignment() -{ - //test one align each, and then test if two align fails. - - for (int i = 0; i < standard.size(); i++) - { - for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); - } - } - - for (int i = 0; i < richText.size(); i++) - { - for (int j=0; j < horizontalAlignmentmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nText { horizontalAlignment: \"" + horizontalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j)); - } - } - -} - -void tst_qmlgraphicstext::verticalAlignment() -{ - //test one align each, and then test if two align fails. - - for (int i = 0; i < standard.size(); i++) - { - for (int j=0; j < verticalAlignmentmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); - } - } - - for (int i = 0; i < richText.size(); i++) - { - for (int j=0; j < verticalAlignmentmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nText { verticalAlignment: \"" + verticalAlignmentmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j)); - } - } - -} - -void tst_qmlgraphicstext::font() -{ - //test size, then bold, then italic, then family - { - QString componentStr = "import Qt 4.6\nText { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().pointSize(), 40); - QCOMPARE(textObject->font().bold(), false); - QCOMPARE(textObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nText { font.pixelSize: 40; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().pixelSize(), 40); - QCOMPARE(textObject->font().bold(), false); - QCOMPARE(textObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nText { font.bold: true; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().bold(), true); - QCOMPARE(textObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nText { font.italic: true; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().italic(), true); - QCOMPARE(textObject->font().bold(), false); - } - - { - QString componentStr = "import Qt 4.6\nText { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().family(), QString("Helvetica")); - QCOMPARE(textObject->font().bold(), false); - QCOMPARE(textObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nText { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->font().family(), QString("")); - } -} - -void tst_qmlgraphicstext::style() -{ - //test style - for (int i = 0; i < styles.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; styleColor: \"white\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE((int)textObject->style(), (int)styles.at(i)); - QCOMPARE(textObject->styleColor(), QColor("white")); - } -} - -void tst_qmlgraphicstext::color() -{ - //test style - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); - QCOMPARE(textObject->styleColor(), QColor()); - } - - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nText { styleColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(i))); - // default color to black? - QCOMPARE(textObject->color(), QColor("black")); - } - - for (int i = 0; i < colorStrings.size(); i++) - { - for (int j = 0; j < colorStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStrings.at(i) + "\"; styleColor: \"" + colorStrings.at(j) + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->color(), QColor(colorStrings.at(i))); - QCOMPARE(textObject->styleColor(), QColor(colorStrings.at(j))); - } - } - { - QString colorStr = "#AA001234"; - QColor testColor("#001234"); - testColor.setAlpha(170); - - QString componentStr = "import Qt 4.6\nText { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QCOMPARE(textObject->color(), testColor); - } -} - -void tst_qmlgraphicstext::smooth() -{ - for (int i = 0; i < standard.size(); i++) - { - { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - QCOMPARE(textObject->smooth(), true); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - QCOMPARE(textObject->smooth(), false); - } - } - for (int i = 0; i < richText.size(); i++) - { - { - QString componentStr = "import Qt 4.6\nText { smooth: true; text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - QCOMPARE(textObject->smooth(), true); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - QCOMPARE(textObject->smooth(), false); - } - } -} - -void tst_qmlgraphicstext::weight() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Normal); - } - { - QString componentStr = "import Qt 4.6\nText { font.weight: \"Bold\"; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().weight(), (int)QmlFontValueType::Bold); - } -} - -void tst_qmlgraphicstext::underline() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().underline(), false); - } - { - QString componentStr = "import Qt 4.6\nText { font.underline: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().underline(), true); - } -} - -void tst_qmlgraphicstext::overline() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().overline(), false); - } - { - QString componentStr = "import Qt 4.6\nText { font.overline: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().overline(), true); - } -} - -void tst_qmlgraphicstext::strikeout() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().strikeOut(), false); - } - { - QString componentStr = "import Qt 4.6\nText { font.strikeout: true; text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().strikeOut(), true); - } -} - -void tst_qmlgraphicstext::capitalization() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::MixedCase); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllUppercase\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllUppercase); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"AllLowercase\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::AllLowercase); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"SmallCaps\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::SmallCaps); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.capitalization: \"Capitalize\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE((int)textObject->font().capitalization(), (int)QmlFontValueType::Capitalize); - } -} - -void tst_qmlgraphicstext::letterSpacing() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().letterSpacing(), 0.0); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: -50 }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().letterSpacing(), -50.); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.letterSpacing: 200 }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().letterSpacing(), 200.); - } -} - -void tst_qmlgraphicstext::wordSpacing() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().wordSpacing(), 0.0); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: -50 }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().wordSpacing(), -50.); - } - { - QString componentStr = "import Qt 4.6\nText { text: \"Hello world!\"; font.wordSpacing: 200 }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - QCOMPARE(textObject->font().wordSpacing(), 200.); - } -} - -class EventSender : public QGraphicsItem -{ -public: - void sendEvent(QEvent *event) { sceneEvent(event); } -}; - -class LinkTest : public QObject -{ - Q_OBJECT -public: - LinkTest() {} - - QString link; - -public slots: - void linkClicked(QString l) { link = l; } -}; - -void tst_qmlgraphicstext::clickLink() -{ - { - QString componentStr = "import Qt 4.6\nText { text: \"<a href=\\\"http://qt.nokia.com\\\">Hello world!</a>\" }"; - QmlComponent textComponent(&engine); - textComponent.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsText *textObject = qobject_cast<QmlGraphicsText*>(textComponent.create()); - - QVERIFY(textObject != 0); - - LinkTest test; - QObject::connect(textObject, SIGNAL(linkActivated(QString)), &test, SLOT(linkClicked(QString))); - - { - QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMousePress); - me.setPos(QPointF(textObject->x()/2, textObject->y()/2)); - me.setButton(Qt::LeftButton); - static_cast<EventSender*>(static_cast<QGraphicsItem*>(textObject))->sendEvent(&me); - } - - { - QGraphicsSceneMouseEvent me(QEvent::GraphicsSceneMouseRelease); - me.setPos(QPointF(textObject->x()/2, textObject->y()/2)); - me.setButton(Qt::LeftButton); - static_cast<EventSender*>(static_cast<QGraphicsItem*>(textObject))->sendEvent(&me); - } - - QCOMPARE(test.link, QLatin1String("http://qt.nokia.com")); - } -} - -QTEST_MAIN(tst_qmlgraphicstext) - -#include "tst_qmlgraphicstext.moc" diff --git a/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro b/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro deleted file mode 100644 index a129120..0000000 --- a/tests/auto/declarative/qmlgraphicstextedit/qmlgraphicstextedit.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui network -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicstextedit.cpp ../shared/testhttpserver.cpp -HEADERS += ../shared/testhttpserver.h - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp b/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp deleted file mode 100644 index cc2f929..0000000 --- a/tests/auto/declarative/qmlgraphicstextedit/tst_qmlgraphicstextedit.cpp +++ /dev/null @@ -1,798 +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 <qtest.h> -#include "../../../shared/util.h" -#include "../shared/testhttpserver.h" -#include <math.h> -#include <QFile> -#include <QTextDocument> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlexpression.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicstextedit_p.h> -#include <QFontMetrics> -#include <QmlView> -#include <QStyle> -#include <QInputContext> - -class tst_qmlgraphicstextedit : public QObject - -{ - Q_OBJECT -public: - tst_qmlgraphicstextedit(); - -private slots: - void text(); - void width(); - void wrap(); - void textFormat(); - - // ### these tests may be trivial - void hAlign(); - void vAlign(); - void font(); - void color(); - void textMargin(); - void persistentSelection(); - void focusOnPress(); - void selection(); - void inputMethodHints(); - - void cursorDelegate(); - void delegateLoading(); - void navigation(); - void readOnly(); - void sendRequestSoftwareInputPanelEvent(); - -private: - void simulateKey(QmlView *, int key); - QmlView *createView(const QString &filename); - - QStringList standard; - QStringList richText; - - QStringList hAlignmentStrings; - QStringList vAlignmentStrings; - - QList<Qt::Alignment> vAlignments; - QList<Qt::Alignment> hAlignments; - - QStringList colorStrings; - - QmlEngine engine; -}; - -tst_qmlgraphicstextedit::tst_qmlgraphicstextedit() -{ - standard << "the quick brown fox jumped over the lazy dog" - << "the quick brown fox\n jumped over the lazy dog"; - - richText << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a> jumped over the <b>lazy</b> dog</i>" - << "<i>the <b>quick</b> brown <a href=\\\"http://www.google.com\\\">fox</a><br>jumped over the <b>lazy</b> dog</i>"; - - hAlignmentStrings << "AlignLeft" - << "AlignRight" - << "AlignHCenter"; - - vAlignmentStrings << "AlignTop" - << "AlignBottom" - << "AlignVCenter"; - - hAlignments << Qt::AlignLeft - << Qt::AlignRight - << Qt::AlignHCenter; - - vAlignments << Qt::AlignTop - << Qt::AlignBottom - << Qt::AlignVCenter; - - colorStrings << "aliceblue" - << "antiquewhite" - << "aqua" - << "darkkhaki" - << "darkolivegreen" - << "dimgray" - << "palevioletred" - << "lightsteelblue" - << "#000000" - << "#AAAAAA" - << "#FFFFFF" - << "#2AC05F"; - // - // need a different test to do alpha channel test - // << "#AA0011DD" - // << "#00F16B11"; - // -} - -void tst_qmlgraphicstextedit::text() -{ - { - QmlComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->text(), QString("")); - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->text(), standard.at(i)); - } - - for (int i = 0; i < richText.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QString actual = textEditObject->text(); - QString expected = richText.at(i); - actual.replace(QRegExp(".*<body[^>]*>"),""); - actual.replace(QRegExp("(<[^>]*>)+"),"<>"); - expected.replace(QRegExp("(<[^>]*>)+"),"<>"); - QCOMPARE(actual.simplified(),expected.simplified()); - } -} - -void tst_qmlgraphicstextedit::width() -{ - // uses Font metrics to find the width for standard and document to find the width for rich - { - QmlComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\" }", QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), 1.);//+1 for cursor - } - - for (int i = 0; i < standard.size(); i++) - { - QFont f; - QFontMetricsF fm(f); - qreal metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width(); - metricWidth = floor(metricWidth); - - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(metricWidth + 1 + 3));//+3 is the current way of accounting for space between cursor and last character. - } - - for (int i = 0; i < richText.size(); i++) - { - QTextDocument document; - document.setHtml(richText.at(i)); - document.setDocumentMargin(0); - - int documentWidth = document.idealWidth(); - - QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), qreal(documentWidth + 1 + 3)); - } -} - -void tst_qmlgraphicstextedit::wrap() -{ - // for specified width and wrap set true - { - QmlComponent texteditComponent(&engine); - texteditComponent.setData("import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), 300.); - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), 300.); - } - - for (int i = 0; i < richText.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->width(), 300.); - } - -} - -void tst_qmlgraphicstextedit::textFormat() -{ - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"Hello\"; textFormat: Text.RichText }", QUrl::fromLocalFile("")); - QmlGraphicsTextEdit *textObject = qobject_cast<QmlGraphicsTextEdit*>(textComponent.create()); - - QVERIFY(textObject != 0); - QVERIFY(textObject->textFormat() == QmlGraphicsTextEdit::RichText); - } - { - QmlComponent textComponent(&engine); - textComponent.setData("import Qt 4.6\nTextEdit { text: \"<b>Hello</b>\"; textFormat: Text.PlainText }", QUrl::fromLocalFile("")); - QmlGraphicsTextEdit *textObject = qobject_cast<QmlGraphicsTextEdit*>(textComponent.create()); - - QVERIFY(textObject != 0); - QVERIFY(textObject->textFormat() == QmlGraphicsTextEdit::PlainText); - } -} - -//the alignment tests may be trivial o.oa -void tst_qmlgraphicstextedit::hAlign() -{ - //test one align each, and then test if two align fails. - - for (int i = 0; i < standard.size(); i++) - { - for (int j=0; j < hAlignmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); - } - } - - for (int i = 0; i < richText.size(); i++) - { - for (int j=0; j < hAlignmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nTextEdit { horizontalAlignment: \"" + hAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j)); - } - } - -} - -void tst_qmlgraphicstextedit::vAlign() -{ - //test one align each, and then test if two align fails. - - for (int i = 0; i < standard.size(); i++) - { - for (int j=0; j < vAlignmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + standard.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); - } - } - - for (int i = 0; i < richText.size(); i++) - { - for (int j=0; j < vAlignmentStrings.size(); j++) - { - QString componentStr = "import Qt 4.6\nTextEdit { verticalAlignment: \"" + vAlignmentStrings.at(j) + "\"; text: \"" + richText.at(i) + "\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j)); - } - } - -} - -void tst_qmlgraphicstextedit::font() -{ - //test size, then bold, then italic, then family - { - QString componentStr = "import Qt 4.6\nTextEdit { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->font().pointSize(), 40); - QCOMPARE(textEditObject->font().bold(), false); - QCOMPARE(textEditObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { font.bold: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->font().bold(), true); - QCOMPARE(textEditObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { font.italic: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->font().italic(), true); - QCOMPARE(textEditObject->font().bold(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->font().family(), QString("Helvetica")); - QCOMPARE(textEditObject->font().bold(), false); - QCOMPARE(textEditObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->font().family(), QString("")); - } -} - -void tst_qmlgraphicstextedit::color() -{ - //test normal - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i)); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->color(), QColor(colorStrings.at(i))); - } - - //test selection - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->selectionColor(), QColor(colorStrings.at(i))); - } - - //test selected text - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextEdit { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->selectedTextColor(), QColor(colorStrings.at(i))); - } - - { - QString colorStr = "#AA001234"; - QColor testColor("#001234"); - testColor.setAlpha(170); - - QString componentStr = "import Qt 4.6\nTextEdit { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->color(), testColor); - } -} - -void tst_qmlgraphicstextedit::textMargin() -{ - for(qreal i=0; i<=10; i+=0.3){ - QString componentStr = "import Qt 4.6\nTextEdit { textMargin: " + QString::number(i) + "; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->textMargin(), i); - } -} - -void tst_qmlgraphicstextedit::persistentSelection() -{ - { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->persistentSelection(), true); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { persistentSelection: false; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->persistentSelection(), false); - } -} - -void tst_qmlgraphicstextedit::focusOnPress() -{ - { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: true; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->focusOnPress(), true); - } - - { - QString componentStr = "import Qt 4.6\nTextEdit { focusOnPress: false; text: \"Hello World\" }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - QCOMPARE(textEditObject->focusOnPress(), false); - } -} - -void tst_qmlgraphicstextedit::selection() -{ - QString testStr = standard[0];//TODO: What should happen for multiline/rich text? - QString componentStr = "import Qt 4.6\nTextEdit { text: \""+ testStr +"\"; }"; - QmlComponent texteditComponent(&engine); - texteditComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit*>(texteditComponent.create()); - QVERIFY(textEditObject != 0); - - - //Test selection follows cursor - for(int i=0; i<= testStr.size(); i++) { - textEditObject->setCursorPosition(i); - QCOMPARE(textEditObject->cursorPosition(), i); - QCOMPARE(textEditObject->selectionStart(), i); - QCOMPARE(textEditObject->selectionEnd(), i); - QVERIFY(textEditObject->selectedText().isNull()); - } - - textEditObject->setCursorPosition(0); - QVERIFY(textEditObject->cursorPosition() == 0); - QVERIFY(textEditObject->selectionStart() == 0); - QVERIFY(textEditObject->selectionEnd() == 0); - QVERIFY(textEditObject->selectedText().isNull()); - - //Test selection - for(int i=0; i<= testStr.size(); i++) { - textEditObject->setSelectionEnd(i); - QCOMPARE(testStr.mid(0,i), textEditObject->selectedText()); - } - for(int i=0; i<= testStr.size(); i++) { - textEditObject->setSelectionStart(i); - QCOMPARE(testStr.mid(i,testStr.size()-i), textEditObject->selectedText()); - } - - textEditObject->setCursorPosition(0); - QVERIFY(textEditObject->cursorPosition() == 0); - QVERIFY(textEditObject->selectionStart() == 0); - QVERIFY(textEditObject->selectionEnd() == 0); - QVERIFY(textEditObject->selectedText().isNull()); - - for(int i=0; i< testStr.size(); i++) { - textEditObject->setSelectionStart(i); - QCOMPARE(textEditObject->selectionEnd(), i); - QCOMPARE(testStr.mid(i,0), textEditObject->selectedText()); - textEditObject->setSelectionEnd(i+1); - QCOMPARE(textEditObject->selectionStart(), i); - QCOMPARE(testStr.mid(i,1), textEditObject->selectedText()); - } - - for(int i= testStr.size() - 1; i>0; i--) { - textEditObject->setSelectionEnd(i); - QCOMPARE(testStr.mid(i,0), textEditObject->selectedText()); - textEditObject->setSelectionStart(i-1); - QCOMPARE(testStr.mid(i-1,1), textEditObject->selectedText()); - } - - //Test Error Ignoring behaviour - textEditObject->setCursorPosition(0); - QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setSelectionStart(-10); - QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setSelectionStart(100); - QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setSelectionEnd(-10); - QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setSelectionEnd(100); - QVERIFY(textEditObject->selectedText().isNull()); - textEditObject->setSelectionStart(0); - textEditObject->setSelectionEnd(10); - QVERIFY(textEditObject->selectedText().size() == 10); - textEditObject->setSelectionStart(-10); - QVERIFY(textEditObject->selectedText().size() == 10); - textEditObject->setSelectionStart(100); - QVERIFY(textEditObject->selectedText().size() == 10); - textEditObject->setSelectionEnd(-10); - QVERIFY(textEditObject->selectedText().size() == 10); - textEditObject->setSelectionEnd(100); - QVERIFY(textEditObject->selectedText().size() == 10); -} - -void tst_qmlgraphicstextedit::inputMethodHints() -{ - QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - QmlGraphicsTextEdit *textEditObject = qobject_cast<QmlGraphicsTextEdit *>(canvas->rootObject()); - QVERIFY(textEditObject != 0); - QVERIFY(textEditObject->inputMethodHints() & Qt::ImhNoPredictiveText); - textEditObject->setInputMethodHints(Qt::ImhUppercaseOnly); - QVERIFY(textEditObject->inputMethodHints() & Qt::ImhUppercaseOnly); -} - -void tst_qmlgraphicstextedit::cursorDelegate() -{ - QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); - view->show(); - view->setFocus(); - QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject"); - QVERIFY(textEditObject != 0); - QVERIFY(textEditObject->findChild<QmlGraphicsItem*>("cursorInstance")); - //Test Delegate gets created - textEditObject->setFocus(true); - QmlGraphicsItem* delegateObject = textEditObject->findChild<QmlGraphicsItem*>("cursorInstance"); - QVERIFY(delegateObject); - //Test Delegate gets moved - for(int i=0; i<= textEditObject->text().length(); i++){ - textEditObject->setCursorPosition(i); - QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y())); - } - textEditObject->setCursorPosition(0); - QCOMPARE(textEditObject->cursorRect().x(), qRound(delegateObject->x())); - QCOMPARE(textEditObject->cursorRect().y(), qRound(delegateObject->y())); - //Test Delegate gets deleted - textEditObject->setCursorDelegate(0); - QVERIFY(!textEditObject->findChild<QmlGraphicsItem*>("cursorInstance")); -} - -void tst_qmlgraphicstextedit::delegateLoading() -{ - TestHTTPServer server(42332); - server.serveDirectory(SRCDIR "/data/httpfail", TestHTTPServer::Disconnect); - server.serveDirectory(SRCDIR "/data/httpslow", TestHTTPServer::Delay); - server.serveDirectory(SRCDIR "/data/http"); - QmlView* view = new QmlView(0); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestPass.qml")); - view->execute(); - view->show(); - view->setFocus(); - QTRY_VERIFY(view->rootObject());//Wait for loading to finish. - QmlGraphicsTextEdit *textEditObject = view->rootObject()->findChild<QmlGraphicsTextEdit*>("textEditObject"); - // view->rootObject()->dumpObjectTree(); - QVERIFY(textEditObject != 0); - textEditObject->setFocus(true); - QmlGraphicsItem *delegate; - delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateOkay"); - QVERIFY(delegate); - delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateSlow"); - QVERIFY(delegate); - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail1.qml")); - view->execute(); - view->show(); - view->setFocus(); - QTRY_VERIFY(!view->rootObject()); // there is fail item inside this test - view->setSource(QUrl("http://localhost:42332/cursorHttpTestFail2.qml")); - view->execute(); - view->show(); - 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 - //Not sure how to accomplish this with QmlGraphicsTextEdits cursor delegate - //###This could be a case of overzealous defensive programming - //delegate = view->rootObject()->findChild<QmlGraphicsItem*>("delegateErrorB"); - //QVERIFY(!delegate); -} - -/* -TextEdit element should only handle left/right keys until the cursor reaches -the extent of the text, then they should ignore the keys. -*/ -void tst_qmlgraphicstextedit::navigation() -{ - QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsItem *input = qobject_cast<QmlGraphicsItem *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); - - QVERIFY(input != 0); - QTRY_VERIFY(input->hasFocus() == true); - simulateKey(canvas, Qt::Key_Left); - QVERIFY(input->hasFocus() == false); - simulateKey(canvas, Qt::Key_Right); - QVERIFY(input->hasFocus() == true); - simulateKey(canvas, Qt::Key_Right); - QVERIFY(input->hasFocus() == false); - simulateKey(canvas, Qt::Key_Left); - QVERIFY(input->hasFocus() == true); -} - -void tst_qmlgraphicstextedit::readOnly() -{ - QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsTextEdit *edit = qobject_cast<QmlGraphicsTextEdit *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); - - QVERIFY(edit != 0); - QTRY_VERIFY(edit->hasFocus() == true); - QVERIFY(edit->isReadOnly() == true); - QString initial = edit->text(); - for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) - simulateKey(canvas, k); - simulateKey(canvas, Qt::Key_Return); - simulateKey(canvas, Qt::Key_Space); - simulateKey(canvas, Qt::Key_Escape); - QCOMPARE(edit->text(), initial); -} - -void tst_qmlgraphicstextedit::simulateKey(QmlView *view, int key) -{ - QKeyEvent press(QKeyEvent::KeyPress, key, 0); - QKeyEvent release(QKeyEvent::KeyRelease, key, 0); - - QApplication::sendEvent(view, &press); - QApplication::sendEvent(view, &release); -} - -QmlView *tst_qmlgraphicstextedit::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - - canvas->setSource(QUrl::fromLocalFile(filename)); - return canvas; -} - -class MyInputContext : public QInputContext -{ -public: - MyInputContext() : softwareInputPanelEventReceived(false) {} - ~MyInputContext() {} - - QString identifierName() { return QString(); } - QString language() { return QString(); } - - void reset() {} - - bool isComposing() const { return false; } - - bool filterEvent( const QEvent *event ) - { - if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; - return QInputContext::filterEvent(event); - } - bool softwareInputPanelEventReceived; -}; - -void tst_qmlgraphicstextedit::sendRequestSoftwareInputPanelEvent() -{ - QGraphicsScene scene; - QGraphicsView view(&scene); - MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); - QmlGraphicsTextEdit edit; - edit.setText("Hello world"); - edit.setPos(0, 0); - scene.addItem(&edit); - view.show(); - qApp->setAutoSipEnabled(true); - QApplication::setActiveWindow(&view); - QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(edit.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); -} -QTEST_MAIN(tst_qmlgraphicstextedit) - -#include "tst_qmlgraphicstextedit.moc" diff --git a/tests/auto/declarative/qmlgraphicstextinput/qmlgraphicstextinput.pro b/tests/auto/declarative/qmlgraphicstextinput/qmlgraphicstextinput.pro deleted file mode 100644 index fd75fec..0000000 --- a/tests/auto/declarative/qmlgraphicstextinput/qmlgraphicstextinput.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicstextinput.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp b/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp deleted file mode 100644 index 8b45fc7..0000000 --- a/tests/auto/declarative/qmlgraphicstextinput/tst_qmlgraphicstextinput.cpp +++ /dev/null @@ -1,663 +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 <qtest.h> -#include "../../../shared/util.h" -#include <QtDeclarative/qmlengine.h> -#include <QFile> -#include <QtDeclarative/qmlview.h> -#include <private/qmlgraphicstextinput_p.h> -#include <QDebug> -#include <QStyle> -#include <QInputContext> - -class tst_qmlgraphicstextinput : public QObject - -{ - Q_OBJECT -public: - tst_qmlgraphicstextinput(); - -private slots: - void text(); - void width(); - void font(); - void color(); - void selection(); - - void maxLength(); - void masks(); - void validators(); - void inputMethodHints(); - - void cursorDelegate(); - void navigation(); - void readOnly(); - - void sendRequestSoftwareInputPanelEvent(); - -private: - void simulateKey(QmlView *, int key); - QmlView *createView(const QString &filename); - - QmlEngine engine; - QStringList standard; - QStringList colorStrings; -}; - -tst_qmlgraphicstextinput::tst_qmlgraphicstextinput() -{ - standard << "the quick brown fox jumped over the lazy dog" - << "It's supercalifragisiticexpialidocious!" - << "Hello, world!"; - - colorStrings << "aliceblue" - << "antiquewhite" - << "aqua" - << "darkkhaki" - << "darkolivegreen" - << "dimgray" - << "palevioletred" - << "lightsteelblue" - << "#000000" - << "#AAAAAA" - << "#FFFFFF" - << "#2AC05F"; -} - -void tst_qmlgraphicstextinput::text() -{ - { - QmlComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->text(), QString("")); - } - - for (int i = 0; i < standard.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->text(), standard.at(i)); - } - -} - -void tst_qmlgraphicstextinput::width() -{ - // uses Font metrics to find the width for standard - { - QmlComponent textinputComponent(&engine); - textinputComponent.setData("import Qt 4.6\nTextInput { text: \"\" }", QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), 1.);//1 for the cursor - } - - for (int i = 0; i < standard.size(); i++) - { - QFont f; - QFontMetricsF fm(f); - qreal metricWidth = fm.width(standard.at(i)); - - QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor - } -} - -void tst_qmlgraphicstextinput::font() -{ - //test size, then bold, then italic, then family - { - QString componentStr = "import Qt 4.6\nTextInput { font.pointSize: 40; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->font().pointSize(), 40); - QCOMPARE(textinputObject->font().bold(), false); - QCOMPARE(textinputObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextInput { font.bold: true; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->font().bold(), true); - QCOMPARE(textinputObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextInput { font.italic: true; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->font().italic(), true); - QCOMPARE(textinputObject->font().bold(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"Helvetica\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->font().family(), QString("Helvetica")); - QCOMPARE(textinputObject->font().bold(), false); - QCOMPARE(textinputObject->font().italic(), false); - } - - { - QString componentStr = "import Qt 4.6\nTextInput { font.family: \"\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->font().family(), QString("")); - } -} - -void tst_qmlgraphicstextinput::color() -{ - //test color - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->color(), QColor(colorStrings.at(i))); - } - - //test selection color - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextInput { selectionColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->selectionColor(), QColor(colorStrings.at(i))); - } - - //test selected text color - for (int i = 0; i < colorStrings.size(); i++) - { - QString componentStr = "import Qt 4.6\nTextInput { selectedTextColor: \"" + colorStrings.at(i) + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->selectedTextColor(), QColor(colorStrings.at(i))); - } - - { - QString colorStr = "#AA001234"; - QColor testColor("#001234"); - testColor.setAlpha(170); - - QString componentStr = "import Qt 4.6\nTextInput { color: \"" + colorStr + "\"; text: \"Hello World\" }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - - QVERIFY(textinputObject != 0); - QCOMPARE(textinputObject->color(), testColor); - } -} - -void tst_qmlgraphicstextinput::selection() -{ - QString testStr = standard[0]; - QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }"; - QmlComponent textinputComponent(&engine); - textinputComponent.setData(componentStr.toLatin1(), QUrl()); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput*>(textinputComponent.create()); - QVERIFY(textinputObject != 0); - - - //Test selection follows cursor - for(int i=0; i<= testStr.size(); i++) { - textinputObject->setCursorPosition(i); - QCOMPARE(textinputObject->cursorPosition(), i); - QCOMPARE(textinputObject->selectionStart(), i); - QCOMPARE(textinputObject->selectionEnd(), i); - QVERIFY(textinputObject->selectedText().isNull()); - } - - textinputObject->setCursorPosition(0); - QVERIFY(textinputObject->cursorPosition() == 0); - QVERIFY(textinputObject->selectionStart() == 0); - QVERIFY(textinputObject->selectionEnd() == 0); - QVERIFY(textinputObject->selectedText().isNull()); - - //Test selection - for(int i=0; i<= testStr.size(); i++) { - textinputObject->setSelectionEnd(i); - QCOMPARE(testStr.mid(0,i), textinputObject->selectedText()); - } - for(int i=0; i<= testStr.size(); i++) { - textinputObject->setSelectionStart(i); - QCOMPARE(testStr.mid(i,testStr.size()-i), textinputObject->selectedText()); - } - - textinputObject->setCursorPosition(0); - QVERIFY(textinputObject->cursorPosition() == 0); - QVERIFY(textinputObject->selectionStart() == 0); - QVERIFY(textinputObject->selectionEnd() == 0); - QVERIFY(textinputObject->selectedText().isNull()); - - for(int i=0; i< testStr.size(); i++) { - textinputObject->setSelectionStart(i); - QCOMPARE(textinputObject->selectionEnd(), i); - QCOMPARE(testStr.mid(i,0), textinputObject->selectedText()); - textinputObject->setSelectionEnd(i+1); - QCOMPARE(textinputObject->selectionStart(), i); - QCOMPARE(testStr.mid(i,1), textinputObject->selectedText()); - } - - for(int i= testStr.size() - 1; i>0; i--) { - textinputObject->setSelectionEnd(i); - QCOMPARE(testStr.mid(i,0), textinputObject->selectedText()); - textinputObject->setSelectionStart(i-1); - QCOMPARE(testStr.mid(i-1,1), textinputObject->selectedText()); - } - - //Test Error Ignoring behaviour - textinputObject->setCursorPosition(0); - QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setSelectionStart(-10); - QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setSelectionStart(100); - QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setSelectionEnd(-10); - QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setSelectionEnd(100); - QVERIFY(textinputObject->selectedText().isNull()); - textinputObject->setSelectionStart(0); - textinputObject->setSelectionEnd(10); - QVERIFY(textinputObject->selectedText().size() == 10); - textinputObject->setSelectionStart(-10); - QVERIFY(textinputObject->selectedText().size() == 10); - textinputObject->setSelectionStart(100); - QVERIFY(textinputObject->selectedText().size() == 10); - textinputObject->setSelectionEnd(-10); - QVERIFY(textinputObject->selectedText().size() == 10); - textinputObject->setSelectionEnd(100); - QVERIFY(textinputObject->selectedText().size() == 10); -} - -void tst_qmlgraphicstextinput::maxLength() -{ - //QString componentStr = "import Qt 4.6\nTextInput { maximumLength: 10; }"; - QmlView *canvas = createView(SRCDIR "/data/maxLength.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - QVERIFY(canvas->rootObject() != 0); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject()); - QVERIFY(textinputObject != 0); - QVERIFY(textinputObject->text().isEmpty()); - QVERIFY(textinputObject->maxLength() == 10); - foreach(const QString &str, standard){ - QVERIFY(textinputObject->text().length() <= 10); - textinputObject->setText(str); - QVERIFY(textinputObject->text().length() <= 10); - } - - textinputObject->setText(""); - QTRY_VERIFY(textinputObject->hasFocus() == true); - for(int i=0; i<20; i++){ - QCOMPARE(textinputObject->text().length(), qMin(i,10)); - //simulateKey(canvas, Qt::Key_A); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - } -} - -void tst_qmlgraphicstextinput::masks() -{ - //Not a comprehensive test of the possible masks, that's done elsewhere (QLineEdit) - //QString componentStr = "import Qt 4.6\nTextInput { inputMask: 'HHHHhhhh'; }"; - QmlView *canvas = createView(SRCDIR "/data/masks.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - QVERIFY(canvas->rootObject() != 0); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject()); - QVERIFY(textinputObject != 0); - QTRY_VERIFY(textinputObject->hasFocus() == true); - QVERIFY(textinputObject->text().length() == 0); - QCOMPARE(textinputObject->inputMask(), QString("HHHHhhhh; ")); - for(int i=0; i<10; i++){ - QCOMPARE(qMin(i,8), textinputObject->text().length()); - QCOMPARE(i>=4, textinputObject->hasAcceptableInput()); - //simulateKey(canvas, Qt::Key_A); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - } -} - -void tst_qmlgraphicstextinput::validators() -{ - // Note that this test assumes that the validators are working properly - // so you may need to run their tests first. All validators are checked - // here to ensure that their exposure to QML is working. - - QmlView *canvas = createView(SRCDIR "/data/validators.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsTextInput *intInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("intInput"))); - QVERIFY(intInput); - intInput->setFocus(true); - QTRY_VERIFY(intInput->hasFocus()); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(intInput->text(), QLatin1String("1")); - QCOMPARE(intInput->hasAcceptableInput(), false); - QTest::keyPress(canvas, Qt::Key_2); - QTest::keyRelease(canvas, Qt::Key_2, Qt::NoModifier ,10); - QCOMPARE(intInput->text(), QLatin1String("1")); - QCOMPARE(intInput->hasAcceptableInput(), false); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(intInput->text(), QLatin1String("11")); - QCOMPARE(intInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_0); - QTest::keyRelease(canvas, Qt::Key_0, Qt::NoModifier ,10); - QCOMPARE(intInput->text(), QLatin1String("11")); - QCOMPARE(intInput->hasAcceptableInput(), true); - - QmlGraphicsTextInput *dblInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("dblInput"))); - QTRY_VERIFY(dblInput); - dblInput->setFocus(true); - QVERIFY(dblInput->hasFocus() == true); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("1")); - QCOMPARE(dblInput->hasAcceptableInput(), false); - QTest::keyPress(canvas, Qt::Key_2); - QTest::keyRelease(canvas, Qt::Key_2, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("12")); - QCOMPARE(dblInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_Period); - QTest::keyRelease(canvas, Qt::Key_Period, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("12.")); - QCOMPARE(dblInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("12.1")); - QCOMPARE(dblInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("12.11")); - QCOMPARE(dblInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QCOMPARE(dblInput->text(), QLatin1String("12.11")); - QCOMPARE(dblInput->hasAcceptableInput(), true); - - QmlGraphicsTextInput *strInput = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("strInput"))); - QTRY_VERIFY(strInput); - strInput->setFocus(true); - QVERIFY(strInput->hasFocus() == true); - QTest::keyPress(canvas, Qt::Key_1); - QTest::keyRelease(canvas, Qt::Key_1, Qt::NoModifier ,10); - QEXPECT_FAIL("","Will not work until QTBUG-8025 is resolved", Abort); - QCOMPARE(strInput->text(), QLatin1String("")); - QCOMPARE(strInput->hasAcceptableInput(), false); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - QCOMPARE(strInput->text(), QLatin1String("a")); - QCOMPARE(strInput->hasAcceptableInput(), false); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - QCOMPARE(strInput->text(), QLatin1String("aa")); - QCOMPARE(strInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - QCOMPARE(strInput->text(), QLatin1String("aaa")); - QCOMPARE(strInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - QCOMPARE(strInput->text(), QLatin1String("aaaa")); - QCOMPARE(strInput->hasAcceptableInput(), true); - QTest::keyPress(canvas, Qt::Key_A); - QTest::keyRelease(canvas, Qt::Key_A, Qt::NoModifier ,10); - QCOMPARE(strInput->text(), QLatin1String("aaaa")); - QCOMPARE(strInput->hasAcceptableInput(), true); -} - -void tst_qmlgraphicstextinput::inputMethodHints() -{ - QmlView *canvas = createView(SRCDIR "/data/inputmethodhints.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - QmlGraphicsTextInput *textinputObject = qobject_cast<QmlGraphicsTextInput *>(canvas->rootObject()); - QVERIFY(textinputObject != 0); - QVERIFY(textinputObject->inputMethodHints() & Qt::ImhNoPredictiveText); - textinputObject->setInputMethodHints(Qt::ImhUppercaseOnly); - QVERIFY(textinputObject->inputMethodHints() & Qt::ImhUppercaseOnly); -} - -/* -TextInput element should only handle left/right keys until the cursor reaches -the extent of the text, then they should ignore the keys. - -*/ -void tst_qmlgraphicstextinput::navigation() -{ - QmlView *canvas = createView(SRCDIR "/data/navigation.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); - - QVERIFY(input != 0); - input->setCursorPosition(0); - QTRY_VERIFY(input->hasFocus() == true); - simulateKey(canvas, Qt::Key_Left); - QVERIFY(input->hasFocus() == false); - simulateKey(canvas, Qt::Key_Right); - QVERIFY(input->hasFocus() == true); - //QT-2944: If text is selected, then we should deselect first. - input->setCursorPosition(input->text().length()); - input->setSelectionStart(0); - input->setSelectionEnd(input->text().length()); - QVERIFY(input->selectionStart() != input->selectionEnd()); - simulateKey(canvas, Qt::Key_Right); - QVERIFY(input->selectionStart() == input->selectionEnd()); - QVERIFY(input->selectionStart() == input->text().length()); - QVERIFY(input->hasFocus() == true); - simulateKey(canvas, Qt::Key_Right); - QVERIFY(input->hasFocus() == false); - simulateKey(canvas, Qt::Key_Left); - QVERIFY(input->hasFocus() == true); -} - -void tst_qmlgraphicstextinput::cursorDelegate() -{ - QmlView* view = createView(SRCDIR "/data/cursorTest.qml"); - view->execute(); - view->show(); - view->setFocus(); - QmlGraphicsTextInput *textInputObject = view->rootObject()->findChild<QmlGraphicsTextInput*>("textInputObject"); - QVERIFY(textInputObject != 0); - QVERIFY(textInputObject->findChild<QmlGraphicsItem*>("cursorInstance")); - //Test Delegate gets created - textInputObject->setFocus(true); - QmlGraphicsItem* delegateObject = textInputObject->findChild<QmlGraphicsItem*>("cursorInstance"); - QVERIFY(delegateObject); - //Test Delegate gets moved - for(int i=0; i<= textInputObject->text().length(); i++){ - textInputObject->setCursorPosition(i); - //+5 is because the TextInput cursorRect is just a 10xHeight area centered on cursor position - QCOMPARE(textInputObject->cursorRect().x() + 5, qRound(delegateObject->x())); - QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); - } - textInputObject->setCursorPosition(0); - QCOMPARE(textInputObject->cursorRect().x()+5, qRound(delegateObject->x())); - QCOMPARE(textInputObject->cursorRect().y(), qRound(delegateObject->y())); - //Test Delegate gets deleted - textInputObject->setCursorDelegate(0); - QVERIFY(!textInputObject->findChild<QmlGraphicsItem*>("cursorInstance")); -} - -void tst_qmlgraphicstextinput::readOnly() -{ - QmlView *canvas = createView(SRCDIR "/data/readOnly.qml"); - canvas->execute(); - canvas->show(); - canvas->setFocus(); - - QVERIFY(canvas->rootObject() != 0); - - QmlGraphicsTextInput *input = qobject_cast<QmlGraphicsTextInput *>(qvariant_cast<QObject *>(canvas->rootObject()->property("myInput"))); - - QVERIFY(input != 0); - QTRY_VERIFY(input->hasFocus() == true); - QVERIFY(input->isReadOnly() == true); - QString initial = input->text(); - for(int k=Qt::Key_0; k<=Qt::Key_Z; k++) - simulateKey(canvas, k); - simulateKey(canvas, Qt::Key_Return); - simulateKey(canvas, Qt::Key_Space); - simulateKey(canvas, Qt::Key_Escape); - QCOMPARE(input->text(), initial); -} - -void tst_qmlgraphicstextinput::simulateKey(QmlView *view, int key) -{ - QKeyEvent press(QKeyEvent::KeyPress, key, 0); - QKeyEvent release(QKeyEvent::KeyRelease, key, 0); - - QApplication::sendEvent(view, &press); - QApplication::sendEvent(view, &release); -} - -QmlView *tst_qmlgraphicstextinput::createView(const QString &filename) -{ - QmlView *canvas = new QmlView(0); - - canvas->setSource(QUrl::fromLocalFile(filename)); - - return canvas; -} - -class MyInputContext : public QInputContext -{ -public: - MyInputContext() : softwareInputPanelEventReceived(false) {} - ~MyInputContext() {} - - QString identifierName() { return QString(); } - QString language() { return QString(); } - - void reset() {} - - bool isComposing() const { return false; } - - bool filterEvent( const QEvent *event ) - { - if (event->type() == QEvent::RequestSoftwareInputPanel) - softwareInputPanelEventReceived = true; - return QInputContext::filterEvent(event); - } - bool softwareInputPanelEventReceived; -}; - -void tst_qmlgraphicstextinput::sendRequestSoftwareInputPanelEvent() -{ - QGraphicsScene scene; - QGraphicsView view(&scene); - MyInputContext ic; - view.viewport()->setInputContext(&ic); - QStyle::RequestSoftwareInputPanel behavior = QStyle::RequestSoftwareInputPanel( - view.style()->styleHint(QStyle::SH_RequestSoftwareInputPanel)); - if ((behavior != QStyle::RSIP_OnMouseClick)) - QSKIP("This test need to have a style with RSIP_OnMouseClick", SkipSingle); - QmlGraphicsTextInput input; - input.setText("Hello world"); - input.setPos(0, 0); - scene.addItem(&input); - view.show(); - qApp->setAutoSipEnabled(true); - QApplication::setActiveWindow(&view); - QTest::qWaitForWindowShown(&view); - QTRY_COMPARE(QApplication::activeWindow(), static_cast<QWidget *>(&view)); - QTest::mouseClick(view.viewport(), Qt::LeftButton, 0, view.mapFromScene(input.scenePos())); - QApplication::processEvents(); - QCOMPARE(ic.softwareInputPanelEventReceived, true); -} - -QTEST_MAIN(tst_qmlgraphicstextinput) - -#include "tst_qmlgraphicstextinput.moc" diff --git a/tests/auto/declarative/qmlgraphicswebview/data/forward.html b/tests/auto/declarative/qmlgraphicswebview/data/forward.html deleted file mode 100644 index 030446a..0000000 --- a/tests/auto/declarative/qmlgraphicswebview/data/forward.html +++ /dev/null @@ -1,12 +0,0 @@ -<html> -<head><title>Forward</title> -<link rel="icon" sizes="48x48" href="basic.png"> -</head> -<body leftmargin="0" marginwidth="0"> -<table width="123"> -<tbody> -<tr><td>This is more.</td></tr> -</tbody> -</table> -</body> -</html> diff --git a/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro b/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro deleted file mode 100644 index a590616..0000000 --- a/tests/auto/declarative/qmlgraphicswebview/qmlgraphicswebview.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -contains(QT_CONFIG,webkit): QT += webkit -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlgraphicswebview.cpp testtypes.cpp -HEADERS += testtypes.h - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp b/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp deleted file mode 100644 index 00c1b67..0000000 --- a/tests/auto/declarative/qmlgraphicswebview/testtypes.cpp +++ /dev/null @@ -1,49 +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(); - QmlGraphicsWebView::drawContents(p,r); -} - -QML_DEFINE_TYPE(Test,1,0,MyWebView,MyWebView); diff --git a/tests/auto/declarative/qmlgraphicswebview/testtypes.h b/tests/auto/declarative/qmlgraphicswebview/testtypes.h deleted file mode 100644 index 0b3176d..0000000 --- a/tests/auto/declarative/qmlgraphicswebview/testtypes.h +++ /dev/null @@ -1,64 +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$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <private/qmlgraphicswebview_p.h> - -class MyWebView : public QmlGraphicsWebView -{ - Q_OBJECT - Q_PROPERTY(int pixelsPainted READ pixelsPainted); - -public: - MyWebView() : pp(0) {} - - int pixelsPainted() const { return pp; } - - void drawContents(QPainter *p, const QRect &r); - -private: - int pp; -}; - -QML_DECLARE_TYPE(MyWebView); - -#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp b/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp deleted file mode 100644 index f3c39f8..0000000 --- a/tests/auto/declarative/qmlgraphicswebview/tst_qmlgraphicswebview.cpp +++ /dev/null @@ -1,396 +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 <qtest.h> -#include "../../../shared/util.h" -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicswebview_p.h> -#include <private/qmlgraphicswebview_p_p.h> -#include <private/qmlgraphicspositioners_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_qmlgraphicswebview : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicswebview() {} - -private slots: - void basicProperties(); - void settings(); - void historyNav(); - void multipleWindows(); - void elementAreaAt(); - void loadError(); - void setHtml(); - void javaScript(); - void cleanupTestCase(); - void pixelCache(); - -private: - void checkNoErrors(const QmlComponent& component); - QmlEngine engine; - QString tmpDir() const - { - static QString tmpd = QDir::tempPath()+"/tst_qmlgraphicswebview-" - + QDateTime::currentDateTime().toString(QLatin1String("yyyyMMddhhmmss")); - return tmpd; - } -}; - -static QString strippedHtml(QString html) -{ - html.replace(QRegExp("\\s+"),""); - return html; -} - -static QString fileContents(const QString& filename) -{ - QFile file(filename); - file.open(QIODevice::ReadOnly); - return QString::fromUtf8(file.readAll()); -} - - -static void removeRecursive(const QString& dirname) -{ - QDir dir(dirname); - QFileInfoList entries(dir.entryInfoList(QDir::Dirs|QDir::Files|QDir::NoDotAndDotDot)); - for (int i = 0; i < entries.count(); ++i) - if (entries[i].isDir()) - removeRecursive(entries[i].filePath()); - else - dir.remove(entries[i].fileName()); - QDir().rmdir(dirname); -} - -void tst_qmlgraphicswebview::cleanupTestCase() -{ - removeRecursive(tmpDir()); -} - -void tst_qmlgraphicswebview::checkNoErrors(const QmlComponent& component) -{ - // Wait until the component is ready - QTRY_VERIFY(component.isReady()); - - - if (component.isError()) { - QList<QmlError> errors = component.errors(); - for (int ii = 0; ii < errors.count(); ++ii) { - const QmlError &error = errors.at(ii); - QByteArray errorStr = QByteArray::number(error.line()) + ":" + - QByteArray::number(error.column()) + ":" + - error.description().toUtf8(); - qWarning() << errorStr; - } - } - QVERIFY(!component.isError()); -} - -void tst_qmlgraphicswebview::basicProperties() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(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(), QmlGraphicsWebView::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); -} - -void tst_qmlgraphicswebview::settings() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); - checkNoErrors(component); - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create()); - QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - - QmlGraphicsWebSettings *s = wv->settingsObject(); - - // 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); - - 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); - } -} - -void tst_qmlgraphicswebview::historyNav() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/basic.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(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(), QmlGraphicsWebView::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(); - } - - wv->setUrl(QUrl::fromLocalFile(SRCDIR "/data/forward.html")); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->title(),QString("Forward")); - QCOMPARE(strippedHtml(fileContents(SRCDIR "/data/forward.html")), strippedHtml(wv->html())); - QCOMPARE(wv->url(), QUrl::fromLocalFile(SRCDIR "/data/forward.html")); - QCOMPARE(wv->status(), QmlGraphicsWebView::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(), QmlGraphicsWebView::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()); -} - -void tst_qmlgraphicswebview::multipleWindows() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/newwindows.qml")); - checkNoErrors(component); - - QmlGraphicsGrid *grid = qobject_cast<QmlGraphicsGrid*>(component.create()); - QVERIFY(grid != 0); - QTRY_COMPARE(grid->children().count(), 2+5); // Component, Loader, 5 WebViews - QmlGraphicsItem* popup = qobject_cast<QmlGraphicsItem*>(grid->children().at(3)); // first popup after Component, Loaded, original. - QVERIFY(popup != 0); - QTRY_COMPARE(popup->x(), 150.0); -} - -void tst_qmlgraphicswebview::loadError() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/loadError.qml")); - checkNoErrors(component); - QWebSettings::enablePersistentStorage(tmpDir()); - - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(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(), QmlGraphicsWebView::Error); - - wv->reloadAction()->trigger(); - } -} - -void tst_qmlgraphicswebview::setHtml() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/sethtml.qml")); - checkNoErrors(component); - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(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>")); -} - -void tst_qmlgraphicswebview::elementAreaAt() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/elements.qml")); - checkNoErrors(component); - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create()); - QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - - 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_qmlgraphicswebview::javaScript() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/javaScript.qml")); - checkNoErrors(component); - QmlGraphicsWebView *wv = qobject_cast<QmlGraphicsWebView*>(component.create()); - QVERIFY(wv != 0); - QTRY_COMPARE(wv->progress(), 1.0); - QCOMPARE(wv->evaluateJavaScript("123").toInt(), 123); - QCOMPARE(wv->evaluateJavaScript("window.status").toString(), QString("status here")); - QCOMPARE(wv->evaluateJavaScript("window.myjsname.qmlprop").toString(), QString("qmlvalue")); -} - -void tst_qmlgraphicswebview::pixelCache() -{ - QmlComponent 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); - 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); - wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected); // nothing new needed to be painted - wv->setPixelCacheSize(0); // clears the cache - wv->paint(&p,0,0); - QCOMPARE(wv->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->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected*2); // still there - wv->setPixelCacheSize(expected-1); // too small - will clear the cache - wv->paint(&p,0,0); - QCOMPARE(wv->pixelsPainted(), expected*3); // repainted -} - -QTEST_MAIN(tst_qmlgraphicswebview) - -#include "tst_qmlgraphicswebview.moc" diff --git a/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro b/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro deleted file mode 100644 index 0ef7739..0000000 --- a/tests/auto/declarative/qmlimageprovider/qmlimageprovider.pro +++ /dev/null @@ -1,12 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -QT += network -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlimageprovider.cpp - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp b/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp deleted file mode 100644 index d07558a..0000000 --- a/tests/auto/declarative/qmlimageprovider/tst_qmlimageprovider.cpp +++ /dev/null @@ -1,166 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2009 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 <QtTest/QtTest> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlimageprovider.h> -#include <private/qmlgraphicsimage_p.h> - -// QmlImageProvider::request() is run in an idle thread where possible -// Be generous in our timeout. -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 10; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(100); \ - } \ - QVERIFY((expr)); \ - } while (false) - - -class tst_qmlimageprovider : public QObject -{ - Q_OBJECT -public: - tst_qmlimageprovider() - { - } - -private slots: - void imageSource(); - void imageSource_data(); - void removeProvider(); - -private: - QmlEngine engine; -}; - -class TestProvider : public QmlImageProvider -{ -public: - QImage request(const QString &id) { - QImage image; - image.load(SRCDIR "/data/" + id); - return image; - } -}; - -void tst_qmlimageprovider::imageSource_data() -{ - QTest::addColumn<QString>("source"); - QTest::addColumn<QString>("error"); - - QTest::newRow("exists") << "image://test/exists.png" << ""; - QTest::newRow("missing") << "image://test/no-such-file.png" - << "\"Failed to get image from provider: image://test/no-such-file.png\" "; - QTest::newRow("unknown provider") << "image://bogus/exists.png" - << "\"Failed to get image from provider: image://bogus/exists.png\" "; -} - -void tst_qmlimageprovider::imageSource() -{ - QFETCH(QString, source); - QFETCH(QString, error); - - if (!error.isEmpty()) - QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - - engine.addImageProvider("test", new TestProvider); - QVERIFY(engine.imageProvider("test") != 0); - - QString componentStr = "import Qt 4.6\nImage { source: \"" + source + "\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - - TRY_WAIT(obj->status() == QmlGraphicsImage::Loading); - - QCOMPARE(obj->source(), QUrl(source)); - - if (error.isEmpty()) { - TRY_WAIT(obj->status() == QmlGraphicsImage::Ready); - QCOMPARE(obj->width(), 100.); - QCOMPARE(obj->height(), 100.); - QCOMPARE(obj->fillMode(), QmlGraphicsImage::Stretch); - QCOMPARE(obj->progress(), 1.0); - } else { - TRY_WAIT(obj->status() == QmlGraphicsImage::Error); - } - - delete obj; -} - -void tst_qmlimageprovider::removeProvider() -{ - engine.addImageProvider("test2", new TestProvider); - QVERIFY(engine.imageProvider("test2") != 0); - - // add provider, confirm it works - QString componentStr = "import Qt 4.6\nImage { source: \"image://test2/exists1.png\" }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlGraphicsImage *obj = qobject_cast<QmlGraphicsImage*>(component.create()); - QVERIFY(obj != 0); - - TRY_WAIT(obj->status() == QmlGraphicsImage::Loading); - TRY_WAIT(obj->status() == QmlGraphicsImage::Ready); - - QCOMPARE(obj->width(), 100.0); - - // remove the provider and confirm - QString error("\"Failed to get image from provider: image://test2/exists2.png\" "); - QTest::ignoreMessage(QtWarningMsg, error.toUtf8()); - - engine.removeImageProvider("test2"); - - obj->setSource(QUrl("image://test2/exists2.png")); - - TRY_WAIT(obj->status() == QmlGraphicsImage::Loading); - TRY_WAIT(obj->status() == QmlGraphicsImage::Error); - - delete obj; -} - - -QTEST_MAIN(tst_qmlimageprovider) - -#include "tst_qmlimageprovider.moc" diff --git a/tests/auto/declarative/qmlinfo/qmlinfo.pro b/tests/auto/declarative/qmlinfo/qmlinfo.pro deleted file mode 100644 index dbebf92..0000000 --- a/tests/auto/declarative/qmlinfo/qmlinfo.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlinfo.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp b/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp deleted file mode 100644 index e4da993..0000000 --- a/tests/auto/declarative/qmlinfo/tst_qmlinfo.cpp +++ /dev/null @@ -1,139 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QPushButton> -#include <QmlContext> -#include <qmlinfo.h> - -class tst_qmlinfo : public QObject -{ - Q_OBJECT -public: - tst_qmlinfo() {} - -private slots: - void qmlObject(); - void nestedQmlObject(); - void nonQmlObject(); - void nullObject(); - void nonQmlContextedObject(); - -private: - QmlEngine engine; -}; - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -void tst_qmlinfo::qmlObject() -{ - QmlComponent component(&engine, TEST_FILE("qmlObject.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QString message = "QML QObject_QML_0 (" + component.url().toString() + ":3:1) Test Message"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo(object) << "Test Message"; - - QObject *nested = qvariant_cast<QObject *>(object->property("nested")); - QVERIFY(nested != 0); - - message = "QML QtObject (" + component.url().toString() + ":6:13) Second Test Message"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo(nested) << "Second Test Message"; -} - -void tst_qmlinfo::nestedQmlObject() -{ - QmlComponent component(&engine, TEST_FILE("nestedQmlObject.qml")); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QObject *nested = qvariant_cast<QObject *>(object->property("nested")); - QVERIFY(nested != 0); - QObject *nested2 = qvariant_cast<QObject *>(object->property("nested2")); - QVERIFY(nested2 != 0); - - QString message = "QML NestedObject (" + component.url().toString() + ":5:13) Outer Object"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo(nested) << "Outer Object"; - - message = "QML QtObject (" + TEST_FILE("NestedObject.qml").toString() + ":6:14) Inner Object"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - qmlInfo(nested2) << "Inner Object"; -} - -void tst_qmlinfo::nonQmlObject() -{ - QObject object; - QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message"); - qmlInfo(&object) << "Test Message"; - - QPushButton pbObject; - QTest::ignoreMessage(QtWarningMsg, "QML QPushButton (unknown location) Test Message"); - qmlInfo(&pbObject) << "Test Message"; -} - -void tst_qmlinfo::nullObject() -{ - QTest::ignoreMessage(QtWarningMsg, "QML (unknown location) Null Object Test Message"); - qmlInfo(0) << "Null Object Test Message"; -} - -void tst_qmlinfo::nonQmlContextedObject() -{ - QObject object; - QmlContext context(&engine); - QmlEngine::setContextForObject(&object, &context); - QTest::ignoreMessage(QtWarningMsg, "QML QtObject (unknown location) Test Message"); - qmlInfo(&object) << "Test Message"; -} - -QTEST_MAIN(tst_qmlinfo) - -#include "tst_qmlinfo.moc" diff --git a/tests/auto/declarative/qmlinstruction/qmlinstruction.pro b/tests/auto/declarative/qmlinstruction/qmlinstruction.pro deleted file mode 100644 index 41be488..0000000 --- a/tests/auto/declarative/qmlinstruction/qmlinstruction.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative script -SOURCES += tst_qmlinstruction.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp b/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp deleted file mode 100644 index 38d024a..0000000 --- a/tests/auto/declarative/qmlinstruction/tst_qmlinstruction.cpp +++ /dev/null @@ -1,585 +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 <qtest.h> -#include <private/qmlcompiler_p.h> - -class tst_qmlinstruction : public QObject -{ - Q_OBJECT -public: - tst_qmlinstruction() {} - -private slots: - void dump(); -}; - -static QStringList messages; -static void msgHandler(QtMsgType, const char *msg) -{ - messages << QLatin1String(msg); -} - -void tst_qmlinstruction::dump() -{ - QmlCompiledData *data = new QmlCompiledData(0); - { - QmlInstruction i; - i.line = 0; - i.type = QmlInstruction::Init; - i.init.bindingsSize = 0; - i.init.parserStatusSize = 3; - i.init.contextCache = -1; - i.init.compiledBinding = -1; - data->bytecode << i; - } - - { - QmlCompiledData::TypeReference ref; - ref.className = "Test"; - data->types << ref; - - QmlInstruction i; - i.line = 1; - i.type = QmlInstruction::CreateObject; - i.create.type = 0; - i.create.data = -1; - i.create.bindingBits = -1; - i.create.column = 10; - data->bytecode << i; - } - - { - data->primitives << "testId"; - - QmlInstruction i; - i.line = 2; - i.type = QmlInstruction::SetId; - i.setId.value = 0; - i.setId.index = 0; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 3; - i.type = QmlInstruction::SetDefault; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 4; - i.type = QmlInstruction::CreateComponent; - i.createComponent.count = 3; - i.createComponent.column = 4; - i.createComponent.endLine = 14; - i.createComponent.metaObject = 0; - - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 5; - i.type = QmlInstruction::StoreMetaObject; - i.storeMeta.data = 3; - i.storeMeta.aliasData = 6; - i.storeMeta.propertyCache = 7; - - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 6; - i.type = QmlInstruction::StoreFloat; - i.storeFloat.propertyIndex = 3; - i.storeFloat.value = 11.3; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 7; - i.type = QmlInstruction::StoreDouble; - i.storeDouble.propertyIndex = 4; - i.storeDouble.value = 14.8; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 8; - i.type = QmlInstruction::StoreInteger; - i.storeInteger.propertyIndex = 5; - i.storeInteger.value = 9; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 9; - i.type = QmlInstruction::StoreBool; - i.storeBool.propertyIndex = 6; - i.storeBool.value = true; - - data->bytecode << i; - } - - { - data->primitives << "Test String"; - QmlInstruction i; - i.line = 10; - i.type = QmlInstruction::StoreString; - i.storeString.propertyIndex = 7; - i.storeString.value = 1; - data->bytecode << i; - } - - { - data->primitives << "http://www.nokia.com"; - QmlInstruction i; - i.line = 11; - i.type = QmlInstruction::StoreUrl; - i.storeUrl.propertyIndex = 8; - i.storeUrl.value = 2; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 12; - i.type = QmlInstruction::StoreColor; - i.storeColor.propertyIndex = 9; - i.storeColor.value = 0xFF00FF00; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 13; - i.type = QmlInstruction::StoreDate; - i.storeDate.propertyIndex = 10; - i.storeDate.value = 9; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 14; - i.type = QmlInstruction::StoreTime; - i.storeTime.propertyIndex = 11; - i.storeTime.valueIndex = 33; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 15; - i.type = QmlInstruction::StoreDateTime; - i.storeDateTime.propertyIndex = 12; - i.storeDateTime.valueIndex = 44; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 16; - i.type = QmlInstruction::StorePoint; - i.storeRealPair.propertyIndex = 13; - i.storeRealPair.valueIndex = 3; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 17; - i.type = QmlInstruction::StorePointF; - i.storeRealPair.propertyIndex = 14; - i.storeRealPair.valueIndex = 9; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 18; - i.type = QmlInstruction::StoreSize; - i.storeRealPair.propertyIndex = 15; - i.storeRealPair.valueIndex = 8; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 19; - i.type = QmlInstruction::StoreSizeF; - i.storeRealPair.propertyIndex = 16; - i.storeRealPair.valueIndex = 99; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 20; - i.type = QmlInstruction::StoreRect; - i.storeRect.propertyIndex = 17; - i.storeRect.valueIndex = 2; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 21; - i.type = QmlInstruction::StoreRectF; - i.storeRect.propertyIndex = 18; - i.storeRect.valueIndex = 19; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 22; - i.type = QmlInstruction::StoreVector3D; - i.storeVector3D.propertyIndex = 19; - i.storeVector3D.valueIndex = 9; - data->bytecode << i; - } - - { - data->primitives << "color(1, 1, 1, 1)"; - QmlInstruction i; - i.line = 23; - i.type = QmlInstruction::StoreVariant; - i.storeString.propertyIndex = 20; - i.storeString.value = 3; - - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 24; - i.type = QmlInstruction::StoreObject; - i.storeObject.propertyIndex = 21; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 25; - i.type = QmlInstruction::StoreVariantObject; - i.storeObject.propertyIndex = 22; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 26; - i.type = QmlInstruction::StoreInterface; - i.storeObject.propertyIndex = 23; - data->bytecode << i; - } - - { - data->primitives << "console.log(1921)"; - - QmlInstruction i; - i.line = 27; - i.type = QmlInstruction::StoreSignal; - i.storeSignal.signalIndex = 2; - i.storeSignal.value = 4; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 28; - i.type = QmlInstruction::StoreScript; - i.storeScript.value = 2; - //i.storeScript.fileName = 18; - //i.storeScript.lineNumber = 28; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 29; - i.type = QmlInstruction::StoreScriptString; - i.storeScriptString.propertyIndex = 24; - i.storeScriptString.value = 3; - i.storeScriptString.scope = 1; - data->bytecode << i; - } - - { - data->datas << "mySignal"; - - QmlInstruction i; - i.line = 30; - i.type = QmlInstruction::AssignSignalObject; - i.assignSignalObject.signal = 0; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 31; - i.type = QmlInstruction::AssignCustomType; - i.assignCustomType.propertyIndex = 25; - i.assignCustomType.valueIndex = 4; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 32; - i.type = QmlInstruction::StoreBinding; - i.assignBinding.property = 26; - i.assignBinding.value = 3; - i.assignBinding.context = 2; - i.assignBinding.owner = 0; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 33; - i.type = QmlInstruction::StoreCompiledBinding; - i.assignBinding.property = 27; - i.assignBinding.value = 2; - i.assignBinding.context = 4; - i.assignBinding.owner = 0; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 34; - i.type = QmlInstruction::StoreValueSource; - i.assignValueSource.property = 29; - i.assignValueSource.owner = 1; - i.assignValueSource.castValue = 4; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 35; - i.type = QmlInstruction::StoreValueInterceptor; - i.assignValueInterceptor.property = 30; - i.assignValueInterceptor.owner = 2; - i.assignValueInterceptor.castValue = -4; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 36; - i.type = QmlInstruction::BeginObject; - i.begin.castValue = 4; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 38; - i.type = QmlInstruction::StoreObjectQList; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 39; - i.type = QmlInstruction::AssignObjectList; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 40; - i.type = QmlInstruction::FetchAttached; - i.fetchAttached.id = 23; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 42; - i.type = QmlInstruction::FetchQList; - i.fetch.property = 32; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 43; - i.type = QmlInstruction::FetchObject; - i.fetch.property = 33; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 44; - i.type = QmlInstruction::FetchValueType; - i.fetchValue.property = 34; - i.fetchValue.type = 6; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 45; - i.type = QmlInstruction::PopFetchedObject; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 46; - i.type = QmlInstruction::PopQList; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 47; - i.type = QmlInstruction::PopValueType; - i.fetchValue.property = 35; - i.fetchValue.type = 8; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 48; - i.type = QmlInstruction::Defer; - i.defer.deferCount = 7; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = -1; - i.type = QmlInstruction::Defer; - i.defer.deferCount = 7; - data->bytecode << i; - } - - { - QmlInstruction i; - i.line = 50; - i.type = (QmlInstruction::Type)(QmlInstruction::Defer + 1); // Non-existant - data->bytecode << i; - } - - QStringList expect; - expect - << "Index\tLine\tOperation\t\tData1\tData2\tData3\tComments" - << "-------------------------------------------------------------------------------" - << "0\t\t0\tINIT\t\t\t0\t3\t-1\t-1" - << "1\t\t1\tCREATE\t\t\t0\t\t\t\"Test\"" - << "2\t\t2\tSETID\t\t\t0\t\t\t\"testId\"" - << "3\t\t3\tSET_DEFAULT" - << "4\t\t4\tCREATE_COMPONENT\t3" - << "5\t\t5\tSTORE_META\t\t3" - << "6\t\t6\tSTORE_FLOAT\t\t3\t11.3" - << "7\t\t7\tSTORE_DOUBLE\t\t4\t14.8" - << "8\t\t8\tSTORE_INTEGER\t\t5\t9" - << "9\t\t9\tSTORE_BOOL\t\t6\ttrue" - << "10\t\t10\tSTORE_STRING\t\t7\t1\t\t\"Test String\"" - << "11\t\t11\tSTORE_URL\t\t8\t2\t\t\"http://www.nokia.com\"" - << "12\t\t12\tSTORE_COLOR\t\t9\t\t\t\"ff00ff00\"" - << "13\t\t13\tSTORE_DATE\t\t10\t9" - << "14\t\t14\tSTORE_TIME\t\t11\t33" - << "15\t\t15\tSTORE_DATETIME\t\t12\t44" - << "16\t\t16\tSTORE_POINT\t\t13\t3" - << "17\t\t17\tSTORE_POINTF\t\t14\t9" - << "18\t\t18\tSTORE_SIZE\t\t15\t8" - << "19\t\t19\tSTORE_SIZEF\t\t16\t99" - << "20\t\t20\tSTORE_RECT\t\t17\t2" - << "21\t\t21\tSTORE_RECTF\t\t18\t19" - << "22\t\t22\tSTORE_VECTOR3D\t\t19\t9" - << "23\t\t23\tSTORE_VARIANT\t\t20\t3\t\t\"color(1, 1, 1, 1)\"" - << "24\t\t24\tSTORE_OBJECT\t\t21" - << "25\t\t25\tSTORE_VARIANT_OBJECT\t22" - << "26\t\t26\tSTORE_INTERFACE\t\t23" - << "27\t\t27\tSTORE_SIGNAL\t\t2\t4\t\t\"console.log(1921)\"" - << "28\t\t28\tSTORE_SCRIPT\t\t2" - << "29\t\t29\tSTORE_SCRIPT_STRING\t24\t3\t1" - << "30\t\t30\tASSIGN_SIGNAL_OBJECT\t0\t\t\t\"mySignal\"" - << "31\t\t31\tASSIGN_CUSTOMTYPE\t25\t4" - << "32\t\t32\tSTORE_BINDING\t26\t3\t2" - << "33\t\t33\tSTORE_COMPILED_BINDING\t27\t2\t4" - << "34\t\t34\tSTORE_VALUE_SOURCE\t29\t4" - << "35\t\t35\tSTORE_VALUE_INTERCEPTOR\t30\t-4" - << "36\t\t36\tBEGIN\t\t\t4" - << "37\t\t38\tSTORE_OBJECT_QLIST" - << "38\t\t39\tASSIGN_OBJECT_LIST" - << "39\t\t40\tFETCH_ATTACHED\t\t23" - << "40\t\t42\tFETCH_QLIST\t\t32" - << "41\t\t43\tFETCH\t\t\t33" - << "42\t\t44\tFETCH_VALUE\t\t34\t6" - << "43\t\t45\tPOP" - << "44\t\t46\tPOP_QLIST" - << "45\t\t47\tPOP_VALUE\t\t35\t8" - << "46\t\t48\tDEFER\t\t\t7" - << "47\t\tNA\tDEFER\t\t\t7" - << "48\t\t50\tXXX UNKOWN INSTRUCTION\t47" - << "-------------------------------------------------------------------------------"; - - messages = QStringList(); - QtMsgHandler old = qInstallMsgHandler(msgHandler); - data->dumpInstructions(); - qInstallMsgHandler(old); - - QCOMPARE(messages.count(), expect.count()); - for (int ii = 0; ii < messages.count(); ++ii) { - QCOMPARE(messages.at(ii), expect.at(ii)); - } - - data->release(); -} - -QTEST_MAIN(tst_qmlinstruction) - -#include "tst_qmlinstruction.moc" diff --git a/tests/auto/declarative/qmllanguage/data/component.5.errors.txt b/tests/auto/declarative/qmllanguage/data/component.5.errors.txt deleted file mode 100644 index 5e88900..0000000 --- a/tests/auto/declarative/qmllanguage/data/component.5.errors.txt +++ /dev/null @@ -1 +0,0 @@ -4:5:Invalid component specification diff --git a/tests/auto/declarative/qmllanguage/data/script.10.errors.txt b/tests/auto/declarative/qmllanguage/data/script.10.errors.txt deleted file mode 100644 index 8299d23..0000000 --- a/tests/auto/declarative/qmllanguage/data/script.10.errors.txt +++ /dev/null @@ -1 +0,0 @@ -6:9:Invalid component specification diff --git a/tests/auto/declarative/qmllanguage/data/script.12.errors.txt b/tests/auto/declarative/qmllanguage/data/script.12.errors.txt deleted file mode 100644 index 85c8396..0000000 --- a/tests/auto/declarative/qmllanguage/data/script.12.errors.txt +++ /dev/null @@ -1 +0,0 @@ -4:5:QmlJS declaration outside Script element diff --git a/tests/auto/declarative/qmllanguage/data/script.9.errors.txt b/tests/auto/declarative/qmllanguage/data/script.9.errors.txt deleted file mode 100644 index dc1eb53..0000000 --- a/tests/auto/declarative/qmllanguage/data/script.9.errors.txt +++ /dev/null @@ -1 +0,0 @@ -5:9:Invalid component specification diff --git a/tests/auto/declarative/qmllanguage/qmllanguage.pro b/tests/auto/declarative/qmllanguage/qmllanguage.pro deleted file mode 100644 index d1876ef..0000000 --- a/tests/auto/declarative/qmllanguage/qmllanguage.pro +++ /dev/null @@ -1,14 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -QT += script network -macx:CONFIG -= app_bundle - -SOURCES += tst_qmllanguage.cpp \ - testtypes.cpp -HEADERS += testtypes.h - -INCLUDEPATH += ../shared/ -HEADERS += ../shared/testhttpserver.h -SOURCES += ../shared/testhttpserver.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmllanguage/testtypes.cpp b/tests/auto/declarative/qmllanguage/testtypes.cpp deleted file mode 100644 index a295054..0000000 --- a/tests/auto/declarative/qmllanguage/testtypes.cpp +++ /dev/null @@ -1,59 +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" - -QML_DEFINE_INTERFACE(MyInterface); -QML_DEFINE_TYPE(Test,1,0,MyQmlObject,MyQmlObject); -QML_DEFINE_TYPE(Test,1,0,MyTypeObject,MyTypeObject); -QML_DEFINE_TYPE(Test,1,0,MyContainer,MyContainer); -QML_DEFINE_TYPE(Test,1,0,MyPropertyValueSource,MyPropertyValueSource); -QML_DEFINE_TYPE(Test,1,0,MyDotPropertyObject,MyDotPropertyObject); -QML_DEFINE_TYPE(Test,1,0,MyNamespacedType,MyNamespace::MyNamespacedType); -QML_DEFINE_TYPE(Test,1,0,MySecondNamespacedType,MyNamespace::MySecondNamespacedType); -QML_DEFINE_NOCREATE_TYPE(MyGroupedObject); - -QVariant myCustomVariantTypeConverter(const QString &data) -{ - MyCustomVariantType rv; - rv.a = data.toInt(); - return QVariant::fromValue(rv); -} - diff --git a/tests/auto/declarative/qmllanguage/testtypes.h b/tests/auto/declarative/qmllanguage/testtypes.h deleted file mode 100644 index 27b45e4..0000000 --- a/tests/auto/declarative/qmllanguage/testtypes.h +++ /dev/null @@ -1,545 +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$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <QtCore/qobject.h> -#include <QtCore/qrect.h> -#include <QtCore/qdatetime.h> -#include <QtGui/qmatrix.h> -#include <QtGui/qcolor.h> -#include <QtGui/qvector3d.h> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlparserstatus.h> -#include <QtDeclarative/qmlpropertyvaluesource.h> -#include <QtDeclarative/qmlscriptstring.h> - -QVariant myCustomVariantTypeConverter(const QString &data); - -class MyInterface -{ -public: - MyInterface() : id(913) {} - int id; -}; -Q_DECLARE_INTERFACE(MyInterface, "com.trolltech.Qt.Test.MyInterface"); -QML_DECLARE_INTERFACE(MyInterface); - -struct MyCustomVariantType -{ - MyCustomVariantType() : a(0) {} - int a; -}; -Q_DECLARE_METATYPE(MyCustomVariantType); - -class MyAttachedObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int value READ value WRITE setValue) - 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; } - - int value2() const { return m_value2; } - void setValue2(int v) { m_value2 = v; } - -private: - int m_value; - int m_value2; -}; - -class MyQmlObject : public QObject, public MyInterface, public QmlParserStatus -{ - Q_OBJECT - Q_PROPERTY(int value READ value WRITE setValue FINAL) - Q_PROPERTY(QString readOnlyString READ readOnlyString) - Q_PROPERTY(bool enabled READ enabled WRITE setEnabled) - Q_PROPERTY(QRect rect READ rect WRITE setRect) - Q_PROPERTY(QMatrix matrix READ matrix WRITE setMatrix) //assumed to be unsupported by QML - Q_PROPERTY(MyInterface *interfaceProperty READ interface WRITE setInterface) - Q_PROPERTY(int onLiteralSignal READ onLiteralSignal WRITE setOnLiteralSignal); - Q_PROPERTY(MyCustomVariantType customType READ customType WRITE setCustomType); - Q_PROPERTY(MyQmlObject *qmlobjectProperty READ qmlobject WRITE setQmlobject) - - Q_INTERFACES(MyInterface QmlParserStatus) -public: - MyQmlObject() : m_value(-1), m_interface(0), m_qmlobject(0) { qRegisterMetaType<MyCustomVariantType>("MyCustomVariantType"); } - - int value() const { return m_value; } - void setValue(int v) { m_value = v; } - - QString readOnlyString() const { return QLatin1String(""); } - - bool enabled() const { return false; } - void setEnabled(bool) {} - - QRect rect() const { return QRect(); } - void setRect(const QRect&) {} - - QMatrix matrix() const { return QMatrix(); } - void setMatrix(const QMatrix&) {} - - MyInterface *interface() const { return m_interface; } - void setInterface(MyInterface *iface) { m_interface = iface; } - - static MyAttachedObject *qmlAttachedProperties(QObject *other) { - return new MyAttachedObject(other); - } - Q_CLASSINFO("DefaultMethod", "basicSlot()"); - - int onLiteralSignal() const { return m_value; } - void setOnLiteralSignal(int v) { m_value = v; } - - MyQmlObject *qmlobject() const { return m_qmlobject; } - void setQmlobject(MyQmlObject *o) { m_qmlobject = o; } - - MyCustomVariantType customType() const { return m_custom; } - void setCustomType(const MyCustomVariantType &v) { m_custom = v; } -public slots: - void basicSlot() { qWarning("MyQmlObject::basicSlot"); } - void basicSlotWithArgs(int v) { qWarning("MyQmlObject::basicSlotWithArgs(%d)", v); } - -signals: - void basicSignal(); - void basicParameterizedSignal(int parameter); - -private: - friend class tst_qmllanguage; - int m_value; - MyInterface *m_interface; - MyQmlObject *m_qmlobject; - MyCustomVariantType m_custom; -}; -QML_DECLARE_TYPEINFO(MyQmlObject, QML_HAS_ATTACHED_PROPERTIES) -QML_DECLARE_TYPE(MyQmlObject); - -class MyGroupedObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlScriptString script READ script WRITE setScript); -public: - QmlScriptString script() const { return m_script; } - void setScript(const QmlScriptString &s) { m_script = s; } - -private: - QmlScriptString m_script; -}; - -QML_DECLARE_TYPE(MyGroupedObject); - - -class MyTypeObject : public QObject -{ - Q_OBJECT - Q_ENUMS(MyEnum) - Q_FLAGS(MyFlags) - - Q_PROPERTY(QString id READ id WRITE setId); - Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty); - Q_PROPERTY(QmlComponent *componentProperty READ componentProperty WRITE setComponentProperty); - Q_PROPERTY(MyFlags flagProperty READ flagProperty WRITE setFlagProperty); - Q_PROPERTY(MyEnum enumProperty READ enumProperty WRITE setEnumProperty); - Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty); - Q_PROPERTY(uint uintProperty READ uintProperty WRITE setUintProperty); - Q_PROPERTY(int intProperty READ intProperty WRITE setIntProperty); - Q_PROPERTY(qreal realProperty READ realProperty WRITE setRealProperty); - Q_PROPERTY(double doubleProperty READ doubleProperty WRITE setDoubleProperty); - Q_PROPERTY(float floatProperty READ floatProperty WRITE setFloatProperty); - Q_PROPERTY(QColor colorProperty READ colorProperty WRITE setColorProperty); - Q_PROPERTY(QDate dateProperty READ dateProperty WRITE setDateProperty); - Q_PROPERTY(QTime timeProperty READ timeProperty WRITE setTimeProperty); - Q_PROPERTY(QDateTime dateTimeProperty READ dateTimeProperty WRITE setDateTimeProperty); - Q_PROPERTY(QPoint pointProperty READ pointProperty WRITE setPointProperty); - Q_PROPERTY(QPointF pointFProperty READ pointFProperty WRITE setPointFProperty); - Q_PROPERTY(QSize sizeProperty READ sizeProperty WRITE setSizeProperty); - Q_PROPERTY(QSizeF sizeFProperty READ sizeFProperty WRITE setSizeFProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty WRITE setRectProperty NOTIFY rectPropertyChanged); - Q_PROPERTY(QRect rectProperty2 READ rectProperty2 WRITE setRectProperty2); - Q_PROPERTY(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty); - Q_PROPERTY(bool boolProperty READ boolProperty WRITE setBoolProperty); - Q_PROPERTY(QVariant variantProperty READ variantProperty WRITE setVariantProperty); - Q_PROPERTY(QVector3D vectorProperty READ vectorProperty WRITE setVectorProperty); - Q_PROPERTY(QUrl urlProperty READ urlProperty WRITE setUrlProperty); - - Q_PROPERTY(QmlScriptString scriptProperty READ scriptProperty WRITE setScriptProperty); - Q_PROPERTY(MyGroupedObject *grouped READ grouped CONSTANT); - Q_PROPERTY(MyGroupedObject *nullGrouped READ nullGrouped CONSTANT); - -public: - MyTypeObject() - : objectPropertyValue(0), componentPropertyValue(0) {} - - QString idValue; - QString id() const { - return idValue; - } - void setId(const QString &v) { - idValue = v; - } - - QObject *objectPropertyValue; - QObject *objectProperty() const { - return objectPropertyValue; - } - void setObjectProperty(QObject *v) { - objectPropertyValue = v; - } - - QmlComponent *componentPropertyValue; - QmlComponent *componentProperty() const { - return componentPropertyValue; - } - void setComponentProperty(QmlComponent *v) { - componentPropertyValue = v; - } - - enum MyFlag { FlagVal1 = 0x01, FlagVal2 = 0x02, FlagVal3 = 0x04 }; - Q_DECLARE_FLAGS(MyFlags, MyFlag) - MyFlags flagPropertyValue; - MyFlags flagProperty() const { - return flagPropertyValue; - } - void setFlagProperty(MyFlags v) { - flagPropertyValue = v; - } - - enum MyEnum { EnumVal1, EnumVal2 }; - MyEnum enumPropertyValue; - MyEnum enumProperty() const { - return enumPropertyValue; - } - void setEnumProperty(MyEnum v) { - enumPropertyValue = v; - } - - QString stringPropertyValue; - QString stringProperty() const { - return stringPropertyValue; - } - void setStringProperty(const QString &v) { - stringPropertyValue = v; - } - - uint uintPropertyValue; - uint uintProperty() const { - return uintPropertyValue; - } - void setUintProperty(const uint &v) { - uintPropertyValue = v; - } - - int intPropertyValue; - int intProperty() const { - return intPropertyValue; - } - void setIntProperty(const int &v) { - intPropertyValue = v; - } - - qreal realPropertyValue; - qreal realProperty() const { - return realPropertyValue; - } - void setRealProperty(const qreal &v) { - realPropertyValue = v; - } - - double doublePropertyValue; - double doubleProperty() const { - return doublePropertyValue; - } - void setDoubleProperty(const double &v) { - doublePropertyValue = v; - } - - float floatPropertyValue; - float floatProperty() const { - return floatPropertyValue; - } - void setFloatProperty(const float &v) { - floatPropertyValue = v; - } - - QColor colorPropertyValue; - QColor colorProperty() const { - return colorPropertyValue; - } - void setColorProperty(const QColor &v) { - colorPropertyValue = v; - } - - QDate datePropertyValue; - QDate dateProperty() const { - return datePropertyValue; - } - void setDateProperty(const QDate &v) { - datePropertyValue = v; - } - - QTime timePropertyValue; - QTime timeProperty() const { - return timePropertyValue; - } - void setTimeProperty(const QTime &v) { - timePropertyValue = v; - } - - QDateTime dateTimePropertyValue; - QDateTime dateTimeProperty() const { - return dateTimePropertyValue; - } - void setDateTimeProperty(const QDateTime &v) { - dateTimePropertyValue = v; - } - - QPoint pointPropertyValue; - QPoint pointProperty() const { - return pointPropertyValue; - } - void setPointProperty(const QPoint &v) { - pointPropertyValue = v; - } - - QPointF pointFPropertyValue; - QPointF pointFProperty() const { - return pointFPropertyValue; - } - void setPointFProperty(const QPointF &v) { - pointFPropertyValue = v; - } - - QSize sizePropertyValue; - QSize sizeProperty() const { - return sizePropertyValue; - } - void setSizeProperty(const QSize &v) { - sizePropertyValue = v; - } - - QSizeF sizeFPropertyValue; - QSizeF sizeFProperty() const { - return sizeFPropertyValue; - } - void setSizeFProperty(const QSizeF &v) { - sizeFPropertyValue = v; - } - - QRect rectPropertyValue; - QRect rectProperty() const { - return rectPropertyValue; - } - void setRectProperty(const QRect &v) { - rectPropertyValue = v; - emit rectPropertyChanged(); - } - - QRect rectPropertyValue2; - QRect rectProperty2() const { - return rectPropertyValue2; - } - void setRectProperty2(const QRect &v) { - rectPropertyValue2 = v; - } - - QRectF rectFPropertyValue; - QRectF rectFProperty() const { - return rectFPropertyValue; - } - void setRectFProperty(const QRectF &v) { - rectFPropertyValue = v; - } - - bool boolPropertyValue; - bool boolProperty() const { - return boolPropertyValue; - } - void setBoolProperty(const bool &v) { - boolPropertyValue = v; - } - - QVariant variantPropertyValue; - QVariant variantProperty() const { - return variantPropertyValue; - } - void setVariantProperty(const QVariant &v) { - variantPropertyValue = v; - } - - QVector3D vectorPropertyValue; - QVector3D vectorProperty() const { - return vectorPropertyValue; - } - void setVectorProperty(const QVector3D &v) { - vectorPropertyValue = v; - } - - QUrl urlPropertyValue; - QUrl urlProperty() const { - return urlPropertyValue; - } - void setUrlProperty(const QUrl &v) { - urlPropertyValue = v; - } - - QmlScriptString scriptPropertyValue; - QmlScriptString scriptProperty() const { - return scriptPropertyValue; - } - void setScriptProperty(const QmlScriptString &v) { - scriptPropertyValue = v; - } - - MyGroupedObject groupedValue; - MyGroupedObject *grouped() { return &groupedValue; } - - MyGroupedObject *nullGrouped() { return 0; } - - void doAction() { emit action(); } -signals: - void action(); - void rectPropertyChanged(); -}; -Q_DECLARE_OPERATORS_FOR_FLAGS(MyTypeObject::MyFlags) -QML_DECLARE_TYPE(MyTypeObject); - -class MyContainer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlListProperty<QObject> children READ children) - Q_PROPERTY(QmlListProperty<MyInterface> qlistInterfaces READ qlistInterfaces) - Q_CLASSINFO("DefaultProperty", "children"); -public: - MyContainer() {} - - QmlListProperty<QObject> children() { return QmlListProperty<QObject>(this, m_children); } - QList<QObject *> *getChildren() { return &m_children; } - QmlListProperty<MyInterface> qlistInterfaces() { return QmlListProperty<MyInterface>(this, m_interfaces); } - QList<MyInterface *> *getQListInterfaces() { return &m_interfaces; } - - QList<QObject*> m_children; - QList<MyInterface *> m_interfaces; -}; - -QML_DECLARE_TYPE(MyContainer); - - -class MyPropertyValueSource : public QObject, public QmlPropertyValueSource -{ - Q_OBJECT - Q_INTERFACES(QmlPropertyValueSource) -public: - MyPropertyValueSource() - : QmlPropertyValueSource() {} - - QmlMetaProperty prop; - virtual void setTarget(const QmlMetaProperty &p) - { - prop = p; - } -}; -QML_DECLARE_TYPE(MyPropertyValueSource); - -class MyDotPropertyObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(MyQmlObject *obj READ obj) - Q_PROPERTY(MyQmlObject *readWriteObj READ readWriteObj WRITE setReadWriteObj) -public: - MyDotPropertyObject() : m_rwobj(0), m_ownRWObj(false) {} - ~MyDotPropertyObject() - { - if (m_ownRWObj) - delete m_rwobj; - } - - MyQmlObject *obj() { return 0; } - - MyQmlObject *readWriteObj() - { - if (!m_rwobj) { - m_rwobj = new MyQmlObject; - m_ownRWObj = true; - } - return m_rwobj; - } - - void setReadWriteObj(MyQmlObject *obj) - { - if (m_ownRWObj) { - delete m_rwobj; - m_ownRWObj = false; - } - - m_rwobj = obj; - } - -private: - MyQmlObject *m_rwobj; - bool m_ownRWObj; -}; - -QML_DECLARE_TYPE(MyDotPropertyObject); - -namespace MyNamespace { - class MyNamespacedType : public QObject - { - Q_OBJECT - }; - - class MySecondNamespacedType : public QObject - { - Q_OBJECT - Q_PROPERTY(QmlListProperty<MyNamespace::MyNamespacedType> list READ list); - public: - QmlListProperty<MyNamespacedType> list() { return QmlListProperty<MyNamespacedType>(this, m_list); } - - private: - QList<MyNamespacedType *> m_list; - }; -} -QML_DECLARE_TYPE(MyNamespace::MyNamespacedType); -QML_DECLARE_TYPE(MyNamespace::MySecondNamespacedType); - -#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp b/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp deleted file mode 100644 index 4090e1d..0000000 --- a/tests/auto/declarative/qmllanguage/tst_qmllanguage.cpp +++ /dev/null @@ -1,1383 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtCore/qfile.h> -#include <QtCore/qdebug.h> -#include <QtCore/qfileinfo.h> -#include <QtCore/qdir.h> -#include <private/qmlmetaproperty_p.h> -#include "testtypes.h" - -#include "../../../shared/util.h" - -/* -This test case covers QML language issues. This covers everything that does not -involve evaluating ECMAScript expressions and bindings. - -Evaluation of expressions and bindings is covered in qmlecmascript -*/ -class tst_qmllanguage : public QObject -{ - Q_OBJECT -public: - tst_qmllanguage() { - QmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter); - QFileInfo fileInfo(__FILE__); - engine.addImportPath(fileInfo.absoluteDir().filePath(QLatin1String("data/lib"))); - } - -private slots: - void initTestCase(); - void cleanupTestCase(); - - void errors_data(); - void errors(); - - void simpleObject(); - void simpleContainer(); - void interfaceProperty(); - void interfaceQList(); - void assignObjectToSignal(); - void assignObjectToVariant(); - void assignLiteralSignalProperty(); - void assignQmlComponent(); - void assignBasicTypes(); - void assignTypeExtremes(); - void assignCompositeToType(); - void customParserTypes(); - void rootAsQmlComponent(); - void inlineQmlComponents(); - void idProperty(); - void assignSignal(); - void dynamicProperties(); - void dynamicPropertiesNested(); - void listProperties(); - void dynamicObjectProperties(); - void dynamicSignalsAndSlots(); - void simpleBindings(); - void autoComponentCreation(); - void propertyValueSource(); - void attachedProperties(); - void dynamicObjects(); - void customVariantTypes(); - void valueTypes(); - void cppnamespace(); - void aliasProperties(); - void componentCompositeType(); - void i18n(); - void i18n_data(); - void onCompleted(); - void scriptString(); - void defaultPropertyListOrder(); - void declaredPropertyValues(); - - void importsBuiltin_data(); - void importsBuiltin(); - void importsLocal_data(); - void importsLocal(); - void importsRemote_data(); - void importsRemote(); - void importsInstalled_data(); - void importsInstalled(); - void importsOrder_data(); - void importsOrder(); - - void qmlAttachedPropertiesObjectMethod(); - - // regression tests for crashes - void crash1(); - void crash2(); - -private: - QmlEngine engine; - void testType(const QString& qml, const QString& type); -}; - -#define VERIFY_ERRORS(errorfile) \ - if (!errorfile) { \ - if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ - qWarning() << "Unexpected Errors:" << component.errors(); \ - QVERIFY(!component.isError()); \ - QVERIFY(component.errors().isEmpty()); \ - } else { \ - QFile file(QLatin1String(SRCDIR) + QLatin1String("/data/") + QLatin1String(errorfile)); \ - QVERIFY(file.open(QIODevice::ReadOnly)); \ - QByteArray data = file.readAll(); \ - file.close(); \ - QList<QByteArray> expected = data.split('\n'); \ - expected.removeAll(QByteArray("")); \ - QList<QmlError> errors = component.errors(); \ - QList<QByteArray> actual; \ - for (int ii = 0; ii < errors.count(); ++ii) { \ - const QmlError &error = errors.at(ii); \ - QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ - QByteArray::number(error.column()) + ":" + \ - error.description().toUtf8(); \ - actual << errorStr; \ - } \ - if (qgetenv("DEBUG") != "" && expected != actual) \ - qWarning() << "Expected:" << expected << "Actual:" << actual; \ - if (qgetenv("QMLLANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ - QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ - QVERIFY(file.open(QIODevice::WriteOnly)); \ - for (int ii = 0; ii < actual.count(); ++ii) { \ - file.write(actual.at(ii)); file.write("\n"); \ - } \ - file.close(); \ - } else { \ - QCOMPARE(expected, actual); \ - } \ - } - -inline QUrl TEST_FILE(const QString &filename) -{ - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(QLatin1String("data/") + filename)); -} - -inline QUrl TEST_FILE(const char *filename) -{ - return TEST_FILE(QLatin1String(filename)); -} - -void tst_qmllanguage::initTestCase() -{ - // Create locale-specific file - // For POSIX, this will just be data/I18nType.qml, since POSIX is 7-bit - // For iso8859-1 locale, this will just be data/I18nType?????.qml where ????? is 5 8-bit characters - // For utf-8 locale, this will be data/I18nType??????????.qml where ?????????? is 5 8-bit characters, UTF-8 encoded - QFile in(TEST_FILE(QLatin1String("I18nType30.qml")).toLocalFile()); - QVERIFY(in.open(QIODevice::ReadOnly)); - QFile out(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile()); - QVERIFY(out.open(QIODevice::WriteOnly)); - out.write(in.readAll()); -} - -void tst_qmllanguage::cleanupTestCase() -{ - QVERIFY(QFile::remove(TEST_FILE(QString::fromUtf8("I18nType\303\201\303\242\303\243\303\244\303\245.qml")).toLocalFile())); -} - -void tst_qmllanguage::errors_data() -{ - QTest::addColumn<QString>("file"); - QTest::addColumn<QString>("errorFile"); - QTest::addColumn<bool>("create"); - - QTest::newRow("nonexistantProperty.1") << "nonexistantProperty.1.qml" << "nonexistantProperty.1.errors.txt" << false; - QTest::newRow("nonexistantProperty.2") << "nonexistantProperty.2.qml" << "nonexistantProperty.2.errors.txt" << false; - QTest::newRow("nonexistantProperty.3") << "nonexistantProperty.3.qml" << "nonexistantProperty.3.errors.txt" << false; - QTest::newRow("nonexistantProperty.4") << "nonexistantProperty.4.qml" << "nonexistantProperty.4.errors.txt" << false; - QTest::newRow("nonexistantProperty.5") << "nonexistantProperty.5.qml" << "nonexistantProperty.5.errors.txt" << false; - QTest::newRow("nonexistantProperty.6") << "nonexistantProperty.6.qml" << "nonexistantProperty.6.errors.txt" << false; - - QTest::newRow("wrongType (string for int)") << "wrongType.1.qml" << "wrongType.1.errors.txt" << false; - QTest::newRow("wrongType (int for bool)") << "wrongType.2.qml" << "wrongType.2.errors.txt" << false; - QTest::newRow("wrongType (bad rect)") << "wrongType.3.qml" << "wrongType.3.errors.txt" << false; - - QTest::newRow("wrongType (invalid enum)") << "wrongType.4.qml" << "wrongType.4.errors.txt" << false; - QTest::newRow("wrongType (int for uint)") << "wrongType.5.qml" << "wrongType.5.errors.txt" << false; - QTest::newRow("wrongType (string for real)") << "wrongType.6.qml" << "wrongType.6.errors.txt" << false; - QTest::newRow("wrongType (int for color)") << "wrongType.7.qml" << "wrongType.7.errors.txt" << false; - QTest::newRow("wrongType (int for date)") << "wrongType.8.qml" << "wrongType.8.errors.txt" << false; - QTest::newRow("wrongType (int for time)") << "wrongType.9.qml" << "wrongType.9.errors.txt" << false; - QTest::newRow("wrongType (int for datetime)") << "wrongType.10.qml" << "wrongType.10.errors.txt" << false; - QTest::newRow("wrongType (string for point)") << "wrongType.11.qml" << "wrongType.11.errors.txt" << false; - QTest::newRow("wrongType (color for size)") << "wrongType.12.qml" << "wrongType.12.errors.txt" << false; - QTest::newRow("wrongType (number string for int)") << "wrongType.13.qml" << "wrongType.13.errors.txt" << false; - QTest::newRow("wrongType (int for string)") << "wrongType.14.qml" << "wrongType.14.errors.txt" << false; - QTest::newRow("wrongType (int for url)") << "wrongType.15.qml" << "wrongType.15.errors.txt" << false; - - QTest::newRow("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false; - QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false; - QTest::newRow("readOnly.3") << "readOnly.3.qml" << "readOnly.3.errors.txt" << false; - - QTest::newRow("listAssignment.2") << "listAssignment.2.qml" << "listAssignment.2.errors.txt" << false; - QTest::newRow("listAssignment.3") << "listAssignment.3.qml" << "listAssignment.3.errors.txt" << false; - - QTest::newRow("invalidID.1") << "invalidID.qml" << "invalidID.errors.txt" << false; - QTest::newRow("invalidID.2") << "invalidID.2.qml" << "invalidID.2.errors.txt" << false; - QTest::newRow("invalidID.3") << "invalidID.3.qml" << "invalidID.3.errors.txt" << false; - 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("unsupportedProperty") << "unsupportedProperty.qml" << "unsupportedProperty.errors.txt" << false; - QTest::newRow("nullDotProperty") << "nullDotProperty.qml" << "nullDotProperty.errors.txt" << true; - QTest::newRow("fakeDotProperty") << "fakeDotProperty.qml" << "fakeDotProperty.errors.txt" << false; - QTest::newRow("duplicateIDs") << "duplicateIDs.qml" << "duplicateIDs.errors.txt" << false; - QTest::newRow("unregisteredObject") << "unregisteredObject.qml" << "unregisteredObject.errors.txt" << false; - QTest::newRow("empty") << "empty.qml" << "empty.errors.txt" << false; - QTest::newRow("missingObject") << "missingObject.qml" << "missingObject.errors.txt" << false; - QTest::newRow("failingComponent") << "failingComponentTest.qml" << "failingComponent.errors.txt" << false; - QTest::newRow("missingSignal") << "missingSignal.qml" << "missingSignal.errors.txt" << false; - QTest::newRow("finalOverride") << "finalOverride.qml" << "finalOverride.errors.txt" << false; - QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false; - - QTest::newRow("invalidGroupedProperty.1") << "invalidGroupedProperty.1.qml" << "invalidGroupedProperty.1.errors.txt" << false; - QTest::newRow("invalidGroupedProperty.2") << "invalidGroupedProperty.2.qml" << "invalidGroupedProperty.2.errors.txt" << false; - QTest::newRow("invalidGroupedProperty.3") << "invalidGroupedProperty.3.qml" << "invalidGroupedProperty.3.errors.txt" << false; - QTest::newRow("invalidGroupedProperty.4") << "invalidGroupedProperty.4.qml" << "invalidGroupedProperty.4.errors.txt" << false; - 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("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false; - QTest::newRow("importVersionMissing (builtin)") << "importVersionMissingBuiltIn.qml" << "importVersionMissingBuiltIn.errors.txt" << false; - QTest::newRow("importVersionMissing (installed)") << "importVersionMissingInstalled.qml" << "importVersionMissingInstalled.errors.txt" << false; - QTest::newRow("invalidImportID") << "invalidImportID.qml" << "invalidImportID.errors.txt" << false; - - QTest::newRow("signal.1") << "signal.1.qml" << "signal.1.errors.txt" << false; - QTest::newRow("signal.2") << "signal.2.qml" << "signal.2.errors.txt" << false; - QTest::newRow("signal.3") << "signal.3.qml" << "signal.3.errors.txt" << false; - - QTest::newRow("property.1") << "property.1.qml" << "property.1.errors.txt" << false; - QTest::newRow("property.2") << "property.2.qml" << "property.2.errors.txt" << false; - QTest::newRow("property.3") << "property.3.qml" << "property.3.errors.txt" << false; - QTest::newRow("property.4") << "property.4.qml" << "property.4.errors.txt" << false; - QTest::newRow("property.5") << "property.5.qml" << "property.5.errors.txt" << false; - - QTest::newRow("Script.1") << "script.1.qml" << "script.1.errors.txt" << false; - QTest::newRow("Script.2") << "script.2.qml" << "script.2.errors.txt" << false; - QTest::newRow("Script.3") << "script.3.qml" << "script.3.errors.txt" << false; - QTest::newRow("Script.4") << "script.4.qml" << "script.4.errors.txt" << false; - QTest::newRow("Script.5") << "script.5.qml" << "script.5.errors.txt" << false; - QTest::newRow("Script.6") << "script.6.qml" << "script.6.errors.txt" << false; - QTest::newRow("Script.7") << "script.7.qml" << "script.7.errors.txt" << false; - QTest::newRow("Script.8") << "script.8.qml" << "script.8.errors.txt" << false; - QTest::newRow("Script.9") << "script.9.qml" << "script.9.errors.txt" << false; - QTest::newRow("Script.10") << "script.10.qml" << "script.10.errors.txt" << false; - QTest::newRow("Script.11") << "script.11.qml" << "script.11.errors.txt" << false; - QTest::newRow("Script.12") << "script.12.qml" << "script.12.errors.txt" << false; - - QTest::newRow("Component.1") << "component.1.qml" << "component.1.errors.txt" << false; - QTest::newRow("Component.2") << "component.2.qml" << "component.2.errors.txt" << false; - QTest::newRow("Component.3") << "component.3.qml" << "component.3.errors.txt" << false; - QTest::newRow("Component.4") << "component.4.qml" << "component.4.errors.txt" << false; - 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("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; - QTest::newRow("invalidAttachedProperty.4") << "invalidAttachedProperty.4.qml" << "invalidAttachedProperty.4.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.5") << "invalidAttachedProperty.5.qml" << "invalidAttachedProperty.5.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.6") << "invalidAttachedProperty.6.qml" << "invalidAttachedProperty.6.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.7") << "invalidAttachedProperty.7.qml" << "invalidAttachedProperty.7.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.8") << "invalidAttachedProperty.8.qml" << "invalidAttachedProperty.8.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.9") << "invalidAttachedProperty.9.qml" << "invalidAttachedProperty.9.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.10") << "invalidAttachedProperty.10.qml" << "invalidAttachedProperty.10.errors.txt" << false; - QTest::newRow("invalidAttachedProperty.11") << "invalidAttachedProperty.11.qml" << "invalidAttachedProperty.11.errors.txt" << false; - - QTest::newRow("nestedErrors") << "nestedErrors.qml" << "nestedErrors.errors.txt" << false; - QTest::newRow("defaultGrouped") << "defaultGrouped.qml" << "defaultGrouped.errors.txt" << false; - QTest::newRow("emptySignal") << "emptySignal.qml" << "emptySignal.errors.txt" << false; - QTest::newRow("doubleSignal") << "doubleSignal.qml" << "doubleSignal.errors.txt" << false; - QTest::newRow("invalidRoot") << "invalidRoot.qml" << "invalidRoot.errors.txt" << false; - QTest::newRow("missingValueTypeProperty") << "missingValueTypeProperty.qml" << "missingValueTypeProperty.errors.txt" << false; - QTest::newRow("objectValueTypeProperty") << "objectValueTypeProperty.qml" << "objectValueTypeProperty.errors.txt" << false; -} - - -void tst_qmllanguage::errors() -{ - QFETCH(QString, file); - QFETCH(QString, errorFile); - QFETCH(bool, create); - - if (file == "invalidID.6.qml") - QSKIP("Test disabled until we strictly disallow ids from beginning with uppercase letters", SkipSingle); - - QmlComponent component(&engine, TEST_FILE(file)); - - if(create) { - QObject *object = component.create(); - QVERIFY(object == 0); - } - - VERIFY_ERRORS(errorFile.toLatin1().constData()); -} - -void tst_qmllanguage::simpleObject() -{ - QmlComponent component(&engine, TEST_FILE("simpleObject.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -void tst_qmllanguage::simpleContainer() -{ - QmlComponent component(&engine, TEST_FILE("simpleContainer.qml")); - VERIFY_ERRORS(0); - MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); - QCOMPARE(container->getChildren()->count(),2); -} - -void tst_qmllanguage::interfaceProperty() -{ - QmlComponent component(&engine, TEST_FILE("interfaceProperty.qml")); - VERIFY_ERRORS(0); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->interface()); - QVERIFY(object->interface()->id == 913); -} - -void tst_qmllanguage::interfaceQList() -{ - QmlComponent component(&engine, TEST_FILE("interfaceQList.qml")); - VERIFY_ERRORS(0); - MyContainer *container= qobject_cast<MyContainer*>(component.create()); - QVERIFY(container != 0); - QVERIFY(container->getQListInterfaces()->count() == 2); - for(int ii = 0; ii < 2; ++ii) - QVERIFY(container->getQListInterfaces()->at(ii)->id == 913); -} - -void tst_qmllanguage::assignObjectToSignal() -{ - QmlComponent component(&engine, TEST_FILE("assignObjectToSignal.qml")); - VERIFY_ERRORS(0); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); - emit object->basicSignal(); -} - -void tst_qmllanguage::assignObjectToVariant() -{ - QmlComponent component(&engine, TEST_FILE("assignObjectToVariant.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QVariant v = object->property("a"); - QVERIFY(v.userType() == qMetaTypeId<QObject *>()); -} - -void tst_qmllanguage::assignLiteralSignalProperty() -{ - QmlComponent component(&engine, TEST_FILE("assignLiteralSignalProperty.qml")); - VERIFY_ERRORS(0); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->onLiteralSignal(), 10); -} - -// Test is an external component can be loaded and assigned (to a qlist) -void tst_qmllanguage::assignQmlComponent() -{ - QmlComponent component(&engine, TEST_FILE("assignQmlComponent.qml")); - VERIFY_ERRORS(0); - MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->getChildren()->count() == 1); - QObject *child = object->getChildren()->at(0); - QCOMPARE(child->property("x"), QVariant(10)); - QCOMPARE(child->property("y"), QVariant(11)); -} - -// Test literal assignment to all the basic types -void tst_qmllanguage::assignBasicTypes() -{ - QmlComponent component(&engine, TEST_FILE("assignBasicTypes.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->flagProperty(), MyTypeObject::FlagVal1 | MyTypeObject::FlagVal3); - QCOMPARE(object->enumProperty(), MyTypeObject::EnumVal2); - QCOMPARE(object->stringProperty(), QString("Hello World!")); - QCOMPARE(object->uintProperty(), uint(10)); - QCOMPARE(object->intProperty(), -19); - QCOMPARE((float)object->realProperty(), float(23.2)); - QCOMPARE((float)object->doubleProperty(), float(-19.7)); - QCOMPARE((float)object->floatProperty(), float(8.5)); - QCOMPARE(object->colorProperty(), QColor("red")); - QCOMPARE(object->dateProperty(), QDate(1982, 11, 25)); - QCOMPARE(object->timeProperty(), QTime(11, 11, 32)); - QCOMPARE(object->dateTimeProperty(), QDateTime(QDate(2009, 5, 12), QTime(13, 22, 1))); - QCOMPARE(object->pointProperty(), QPoint(99,13)); - QCOMPARE(object->pointFProperty(), QPointF((float)-10.1, (float)12.3)); - QCOMPARE(object->sizeProperty(), QSize(99, 13)); - QCOMPARE(object->sizeFProperty(), QSizeF((float)0.1, (float)0.2)); - QCOMPARE(object->rectProperty(), QRect(9, 7, 100, 200)); - QCOMPARE(object->rectFProperty(), QRectF((float)1000.1, (float)-10.9, (float)400, (float)90.99)); - QCOMPARE(object->boolProperty(), true); - QCOMPARE(object->variantProperty(), QVariant("Hello World!")); - QCOMPARE(object->vectorProperty(), QVector3D(10, 1, 2.2)); - QCOMPARE(object->urlProperty(), component.url().resolved(QUrl("main.qml"))); - QVERIFY(object->objectProperty() != 0); - MyTypeObject *child = qobject_cast<MyTypeObject *>(object->objectProperty()); - QVERIFY(child != 0); - QCOMPARE(child->intProperty(), 8); -} - -// Test edge case type assignments -void tst_qmllanguage::assignTypeExtremes() -{ - QmlComponent component(&engine, TEST_FILE("assignTypeExtremes.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->uintProperty(), 0xEE6B2800); - QCOMPARE(object->intProperty(), -0x77359400); -} - -// Test that a composite type can assign to a property of its base type -void tst_qmllanguage::assignCompositeToType() -{ - QmlComponent component(&engine, TEST_FILE("assignCompositeToType.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -// Tests that custom parser types can be instantiated -void tst_qmllanguage::customParserTypes() -{ - QmlComponent component(&engine, TEST_FILE("customParserTypes.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(object->property("count") == QVariant(2)); -} - -// Tests that the root item can be a custom component -void tst_qmllanguage::rootAsQmlComponent() -{ - QmlComponent component(&engine, TEST_FILE("rootAsQmlComponent.qml")); - VERIFY_ERRORS(0); - MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->property("x"), QVariant(11)); - QCOMPARE(object->getChildren()->count(), 2); -} - -// Tests that components can be specified inline -void tst_qmllanguage::inlineQmlComponents() -{ - QmlComponent component(&engine, TEST_FILE("inlineQmlComponents.qml")); - VERIFY_ERRORS(0); - MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->getChildren()->count(), 1); - QmlComponent *comp = qobject_cast<QmlComponent *>(object->getChildren()->at(0)); - QVERIFY(comp != 0); - MyQmlObject *compObject = qobject_cast<MyQmlObject *>(comp->create()); - QVERIFY(compObject != 0); - QCOMPARE(compObject->value(), 11); -} - -// Tests that types that have an id property have it set -void tst_qmllanguage::idProperty() -{ - QmlComponent component(&engine, TEST_FILE("idProperty.qml")); - VERIFY_ERRORS(0); - MyContainer *object = qobject_cast<MyContainer *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->getChildren()->count(), 1); - MyTypeObject *child = - qobject_cast<MyTypeObject *>(object->getChildren()->at(0)); - QVERIFY(child != 0); - QCOMPARE(child->id(), QString("myObjectId")); - QCOMPARE(object->property("object"), QVariant::fromValue((QObject *)child)); -} - -// Tests that signals can be assigned to -void tst_qmllanguage::assignSignal() -{ - QmlComponent component(&engine, TEST_FILE("assignSignal.qml")); - VERIFY_ERRORS(0); - MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create()); - QVERIFY(object != 0); - QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlot"); - emit object->basicSignal(); - QTest::ignoreMessage(QtWarningMsg, "MyQmlObject::basicSlotWithArgs(9)"); - emit object->basicParameterizedSignal(9); -} - -// Tests the creation and assignment of dynamic properties -void tst_qmllanguage::dynamicProperties() -{ - QmlComponent component(&engine, TEST_FILE("dynamicProperties.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("intProperty"), QVariant(10)); - QCOMPARE(object->property("boolProperty"), QVariant(false)); - QCOMPARE(object->property("doubleProperty"), QVariant(-10.1)); - QCOMPARE(object->property("realProperty"), QVariant((qreal)-19.9)); - QCOMPARE(object->property("stringProperty"), QVariant("Hello World!")); - QCOMPARE(object->property("urlProperty"), QVariant(TEST_FILE("main.qml"))); - QCOMPARE(object->property("colorProperty"), QVariant(QColor("red"))); - QCOMPARE(object->property("dateProperty"), QVariant(QDate(1945, 9, 2))); - QCOMPARE(object->property("varProperty"), QVariant("Hello World!")); - QCOMPARE(object->property("variantProperty"), QVariant(12)); -} - -// Test that nested types can use dynamic properties -void tst_qmllanguage::dynamicPropertiesNested() -{ - QmlComponent component(&engine, TEST_FILE("dynamicPropertiesNested.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("super_a").toInt(), 11); // Overridden - QCOMPARE(object->property("super_c").toInt(), 14); // Inherited - QCOMPARE(object->property("a").toInt(), 13); // New - QCOMPARE(object->property("b").toInt(), 12); // New - - delete object; -} - -// Tests the creation and assignment to dynamic list properties -void tst_qmllanguage::listProperties() -{ - QmlComponent component(&engine, TEST_FILE("listProperties.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toInt(), 2); -} - -// Tests the creation and assignment of dynamic object properties -// ### Not complete -void tst_qmllanguage::dynamicObjectProperties() -{ - QmlComponent component(&engine, TEST_FILE("dynamicObjectProperties.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QVERIFY(object->property("objectProperty") == qVariantFromValue((QObject*)0)); - QVERIFY(object->property("objectProperty2") != qVariantFromValue((QObject*)0)); -} - -// Tests the declaration of dynamic signals and slots -void tst_qmllanguage::dynamicSignalsAndSlots() -{ - QTest::ignoreMessage(QtDebugMsg, "1921"); - - QmlComponent component(&engine, TEST_FILE("dynamicSignalsAndSlots.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QVERIFY(object->metaObject()->indexOfMethod("signal1()") != -1); - QVERIFY(object->metaObject()->indexOfMethod("signal2()") != -1); - QVERIFY(object->metaObject()->indexOfMethod("slot1()") != -1); - QVERIFY(object->metaObject()->indexOfMethod("slot2()") != -1); - - QCOMPARE(object->property("test").toInt(), 0); - QMetaObject::invokeMethod(object, "slot3", Qt::DirectConnection, Q_ARG(QVariant, QVariant(10))); - QCOMPARE(object->property("test").toInt(), 10); -} - -void tst_qmllanguage::simpleBindings() -{ - QmlComponent component(&engine, TEST_FILE("simpleBindings.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("value1"), QVariant(10)); - QCOMPARE(object->property("value2"), QVariant(10)); - QCOMPARE(object->property("value3"), QVariant(21)); - QCOMPARE(object->property("value4"), QVariant(10)); - QCOMPARE(object->property("objectProperty"), QVariant::fromValue(object)); -} - -void tst_qmllanguage::autoComponentCreation() -{ - QmlComponent component(&engine, TEST_FILE("autoComponentCreation.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QVERIFY(object->componentProperty() != 0); - MyTypeObject *child = qobject_cast<MyTypeObject *>(object->componentProperty()->create()); - QVERIFY(child != 0); - QCOMPARE(child->realProperty(), qreal(9)); -} - -void tst_qmllanguage::propertyValueSource() -{ - { - QmlComponent component(&engine, TEST_FILE("propertyValueSource.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QList<QObject *> valueSources; - QObjectList allChildren = object->findChildren<QObject*>(); - foreach (QObject *child, allChildren) { - if (qobject_cast<QmlPropertyValueSource *>(child)) - valueSources.append(child); - } - - QCOMPARE(valueSources.count(), 1); - MyPropertyValueSource *valueSource = - qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); - QCOMPARE(valueSource->prop.object(), object); - QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); - } - - { - QmlComponent component(&engine, TEST_FILE("propertyValueSource.2.qml")); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QList<QObject *> valueSources; - QObjectList allChildren = object->findChildren<QObject*>(); - foreach (QObject *child, allChildren) { - if (qobject_cast<QmlPropertyValueSource *>(child)) - valueSources.append(child); - } - - QCOMPARE(valueSources.count(), 1); - MyPropertyValueSource *valueSource = - qobject_cast<MyPropertyValueSource *>(valueSources.at(0)); - QVERIFY(valueSource != 0); - QCOMPARE(valueSource->prop.object(), object); - QCOMPARE(valueSource->prop.name(), QString(QLatin1String("intProperty"))); - } -} - -void tst_qmllanguage::attachedProperties() -{ - QmlComponent component(&engine, TEST_FILE("attachedProperties.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QObject *attached = qmlAttachedPropertiesObject<MyQmlObject>(object); - QVERIFY(attached != 0); - QCOMPARE(attached->property("value"), QVariant(10)); - QCOMPARE(attached->property("value2"), QVariant(13)); -} - -// Tests non-static object properties -void tst_qmllanguage::dynamicObjects() -{ - QmlComponent component(&engine, TEST_FILE("dynamicObject.1.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -// Tests the registration of custom variant string converters -void tst_qmllanguage::customVariantTypes() -{ - QmlComponent component(&engine, TEST_FILE("customVariantTypes.qml")); - VERIFY_ERRORS(0); - MyQmlObject *object = qobject_cast<MyQmlObject*>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->customType().a, 10); -} - -void tst_qmllanguage::valueTypes() -{ - QmlComponent component(&engine, TEST_FILE("valueTypes.qml")); - VERIFY_ERRORS(0); - - QString message = QLatin1String("QML MyTypeObject (") + component.url().toString() + - QLatin1String(":2:1) Binding loop detected for property \"rectProperty.width\""); - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(message)); - - MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); - - - QCOMPARE(object->rectProperty(), QRect(10, 11, 12, 13)); - QCOMPARE(object->rectProperty2(), QRect(10, 11, 12, 13)); - QCOMPARE(object->intProperty(), 10); - object->doAction(); - QCOMPARE(object->rectProperty(), QRect(12, 11, 14, 13)); - QCOMPARE(object->rectProperty2(), QRect(12, 11, 14, 13)); - QCOMPARE(object->intProperty(), 12); - - // ### -#if 0 - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "rectProperty.x"); - QCOMPARE(p.read(), QVariant(12)); - p.write(13); - QCOMPARE(p.read(), QVariant(13)); - - quint32 r = QmlMetaPropertyPrivate::saveValueType(p.coreIndex(), p.valueTypeCoreIndex()); - QmlMetaProperty p2; - QmlMetaPropertyPrivate::restore(p2, r, object); - QCOMPARE(p2.read(), QVariant(13)); -#endif -} - -void tst_qmllanguage::cppnamespace() -{ - { - QmlComponent component(&engine, TEST_FILE("cppnamespace.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("cppnamespace.2.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - delete object; - } -} - -void tst_qmllanguage::aliasProperties() -{ - // Simple "int" alias - { - QmlComponent component(&engine, TEST_FILE("alias.1.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - // Read through alias - QCOMPARE(object->property("valueAlias").toInt(), 10); - object->setProperty("value", QVariant(13)); - QCOMPARE(object->property("valueAlias").toInt(), 13); - - // Write throught alias - object->setProperty("valueAlias", QVariant(19)); - QCOMPARE(object->property("valueAlias").toInt(), 19); - QCOMPARE(object->property("value").toInt(), 19); - - delete object; - } - - // Complex object alias - { - QmlComponent component(&engine, TEST_FILE("alias.2.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - // Read through alias - MyQmlObject *v = - qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v != 0); - QCOMPARE(v->value(), 10); - - // Write through alias - MyQmlObject *v2 = new MyQmlObject(); - v2->setParent(object); - object->setProperty("aliasObject", qVariantFromValue(v2)); - MyQmlObject *v3 = - qvariant_cast<MyQmlObject *>(object->property("aliasObject")); - QVERIFY(v3 != 0); - QCOMPARE(v3, v2); - - delete object; - } - - // Nested aliases - { - QmlComponent component(&engine, TEST_FILE("alias.3.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("value").toInt(), 1892); - QCOMPARE(object->property("value2").toInt(), 1892); - - object->setProperty("value", QVariant(1313)); - QCOMPARE(object->property("value").toInt(), 1313); - QCOMPARE(object->property("value2").toInt(), 1313); - - object->setProperty("value2", QVariant(8080)); - QCOMPARE(object->property("value").toInt(), 8080); - QCOMPARE(object->property("value2").toInt(), 8080); - - delete object; - } - - // Enum aliases - { - QmlComponent component(&engine, TEST_FILE("alias.4.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("enumAlias").toInt(), 1); - - delete object; - } - - // Id aliases - { - QmlComponent component(&engine, TEST_FILE("alias.5.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QVariant v = object->property("otherAlias"); - QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); - MyQmlObject *o = qvariant_cast<MyQmlObject*>(v); - QCOMPARE(o->value(), 10); - - delete o; - - v = object->property("otherAlias"); - QCOMPARE(v.userType(), qMetaTypeId<MyQmlObject*>()); - o = qvariant_cast<MyQmlObject*>(v); - QVERIFY(o == 0); - - delete object; - } - - // Nested aliases - this used to cause a crash - { - QmlComponent component(&engine, TEST_FILE("alias.6.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("a").toInt(), 1923); - } - - // Ptr Alias Cleanup - check that aliases to ptr types return 0 - // if the object aliased to is removed - { - QmlComponent component(&engine, TEST_FILE("alias.7.qml")); - VERIFY_ERRORS(0); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QObject *object1 = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(object1 != 0); - QObject *object2 = qvariant_cast<QObject *>(object1->property("object")); - QVERIFY(object2 != 0); - - QObject *alias = qvariant_cast<QObject *>(object->property("aliasedObject")); - QVERIFY(alias == object2); - - delete object1; - - QObject *alias2 = object; // "Random" start value - int status = -1; - void *a[] = { &alias2, 0, &status }; - QMetaObject::metacall(object, QMetaObject::ReadProperty, - object->metaObject()->indexOfProperty("aliasedObject"), a); - QVERIFY(alias2 == 0); - } - - // Simple composite type - { - QmlComponent component(&engine, TEST_FILE("alias.8.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("value").toInt(), 10); - - delete object; - } - - // Complex composite type - { - QmlComponent component(&engine, TEST_FILE("alias.9.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("value").toInt(), 10); - - delete object; - } -} - -// Test that the root element in a composite type can be a Component -void tst_qmllanguage::componentCompositeType() -{ - QmlComponent component(&engine, TEST_FILE("componentCompositeType.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -class TestType : public QObject { - Q_OBJECT -public: - TestType(QObject *p=0) : QObject(p) {} -}; - -class TestType2 : public QObject { - Q_OBJECT -public: - TestType2(QObject *p=0) : QObject(p) {} -}; - -void tst_qmllanguage::i18n_data() -{ - QTest::addColumn<QString>("file"); - QTest::addColumn<QString>("stringProperty"); - QTest::newRow("i18nStrings") << "i18nStrings.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245 (5 accented 'a' letters)"); - QTest::newRow("i18nDeclaredPropertyNames") << "i18nDeclaredPropertyNames.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 10"); - QTest::newRow("i18nDeclaredPropertyUse") << "i18nDeclaredPropertyUse.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 15"); - QTest::newRow("i18nScript") << "i18nScript.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 20"); - QTest::newRow("i18nType") << "i18nType.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 30"); - QTest::newRow("i18nNameSpace") << "i18nNameSpace.qml" << QString::fromUtf8("Test \303\241\303\242\303\243\303\244\303\245: 40"); -} - -void tst_qmllanguage::i18n() -{ - QFETCH(QString, file); - QFETCH(QString, stringProperty); - QmlComponent component(&engine, TEST_FILE(file)); - VERIFY_ERRORS(0); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->stringProperty(), stringProperty); - - delete object; -} - -// Check that the Component::onCompleted attached property works -void tst_qmllanguage::onCompleted() -{ - QmlComponent component(&engine, TEST_FILE("onCompleted.qml")); - VERIFY_ERRORS(0); - QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); - QTest::ignoreMessage(QtDebugMsg, "Completed 6 10"); - QTest::ignoreMessage(QtDebugMsg, "Completed 10 11"); - QObject *object = component.create(); - QVERIFY(object != 0); -} - -// Check that assignments to QmlScriptString properties work -void tst_qmllanguage::scriptString() -{ - QmlComponent component(&engine, TEST_FILE("scriptString.qml")); - VERIFY_ERRORS(0); - - MyTypeObject *object = qobject_cast<MyTypeObject*>(component.create()); - QVERIFY(object != 0); - QCOMPARE(object->scriptProperty().script(), QString("foo + bar")); - QCOMPARE(object->scriptProperty().scopeObject(), object); - QCOMPARE(object->scriptProperty().context(), qmlContext(object)); - - QVERIFY(object->grouped() != 0); - QCOMPARE(object->grouped()->script().script(), QString("console.log(1921)")); - QCOMPARE(object->grouped()->script().scopeObject(), object); - QCOMPARE(object->grouped()->script().context(), qmlContext(object)); -} - -// Check that default property assignments are correctly spliced into explicit -// property assignments -void tst_qmllanguage::defaultPropertyListOrder() -{ - QmlComponent component(&engine, TEST_FILE("defaultPropertyListOrder.qml")); - VERIFY_ERRORS(0); - - MyContainer *container = qobject_cast<MyContainer *>(component.create()); - QVERIFY(container != 0); - - QCOMPARE(container->getChildren()->count(), 6); - QCOMPARE(container->getChildren()->at(0)->property("index"), QVariant(0)); - QCOMPARE(container->getChildren()->at(1)->property("index"), QVariant(1)); - QCOMPARE(container->getChildren()->at(2)->property("index"), QVariant(2)); - QCOMPARE(container->getChildren()->at(3)->property("index"), QVariant(3)); - QCOMPARE(container->getChildren()->at(4)->property("index"), QVariant(4)); - QCOMPARE(container->getChildren()->at(5)->property("index"), QVariant(5)); -} - -void tst_qmllanguage::declaredPropertyValues() -{ - QmlComponent component(&engine, TEST_FILE("declaredPropertyValues.qml")); - QEXPECT_FAIL("", "QTBUG-7860", Abort); - VERIFY_ERRORS(0); -} - -// Check that first child of qml is of given type. Empty type insists on error. -void tst_qmllanguage::testType(const QString& qml, const QString& type) -{ - QmlComponent component(&engine); - component.setData(qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports - - QTRY_VERIFY(!component.isLoading()); - - if (type.isEmpty()) { - QVERIFY(component.isError()); - } else { - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(QString(object->metaObject()->className()), type); - } -} - -QML_DECLARE_TYPE(TestType) -QML_DECLARE_TYPE(TestType2) - -QML_DEFINE_TYPE(com.nokia.Test, 0, 0, TestTP, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 0, Test, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 5, Test, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 8, Test, TestType2) -QML_DEFINE_TYPE(com.nokia.Test, 1, 9, OldTest, TestType) -QML_DEFINE_TYPE(com.nokia.Test, 1, 12, Test, TestType2) - -// Import tests (QT-558) - -void tst_qmllanguage::importsBuiltin_data() -{ - // QT-610 - - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("type"); - - // import built-ins - QTest::newRow("missing import") - << "Test {}" - << ""; - QTest::newRow("not in version 0.0") - << "import com.nokia.Test 0.0\n" - "Test {}" - << ""; - QTest::newRow("in version 0.0") - << "import com.nokia.Test 0.0\n" - "TestTP {}" - << "TestType"; - QTest::newRow("qualified in version 0.0") - << "import com.nokia.Test 0.0 as T\n" - "T.TestTP {}" - << "TestType"; - QTest::newRow("in version 1.0") - << "import com.nokia.Test 1.0\n" - "Test {}" - << "TestType"; - QTest::newRow("qualified wrong") - << "import com.nokia.Test 1.0 as T\n" // QT-610 - "Test {}" - << ""; - QTest::newRow("qualified right") - << "import com.nokia.Test 1.0 as T\n" - "T.Test {}" - << "TestType"; - QTest::newRow("qualified right but not in version 0.0") - << "import com.nokia.Test 0.0 as T\n" - "T.Test {}" - << ""; - QTest::newRow("in version 1.1") - << "import com.nokia.Test 1.1\n" - "Test {}" - << "TestType"; - QTest::newRow("in version 1.3") - << "import com.nokia.Test 1.3\n" - "Test {}" - << "TestType"; - QTest::newRow("in version 1.5") - << "import com.nokia.Test 1.5\n" - "Test {}" - << "TestType"; - QTest::newRow("changed in version 1.8") - << "import com.nokia.Test 1.8\n" - "Test {}" - << "TestType2"; - QTest::newRow("in version 1.12") - << "import com.nokia.Test 1.12\n" - "Test {}" - << "TestType2"; - QTest::newRow("old in version 1.9") - << "import com.nokia.Test 1.9\n" - "OldTest {}" - << "TestType"; - QTest::newRow("old in version 1.11") - << "import com.nokia.Test 1.11\n" - "OldTest {}" - << "TestType"; - QTest::newRow("multiversion 1") - << "import com.nokia.Test 1.11\n" - "import com.nokia.Test 1.12\n" - "Test {}" - << "TestType2"; - QTest::newRow("multiversion 2") - << "import com.nokia.Test 1.11\n" - "import com.nokia.Test 1.12\n" - "OldTest {}" - << "TestType"; - QTest::newRow("qualified multiversion 3") - << "import com.nokia.Test 1.0 as T0\n" - "import com.nokia.Test 1.8 as T8\n" - "T0.Test {}" - << "TestType"; - QTest::newRow("qualified multiversion 4") - << "import com.nokia.Test 1.0 as T0\n" - "import com.nokia.Test 1.8 as T8\n" - "T8.Test {}" - << "TestType2"; -} - -void tst_qmllanguage::importsBuiltin() -{ - QFETCH(QString, qml); - QFETCH(QString, type); - testType(qml,type); -} - -void tst_qmllanguage::importsLocal_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("type"); - - // import locals - QTest::newRow("local import") - << "import \"subdir\"\n" // QT-613 - "Test {}" - << "QmlGraphicsRectangle"; - QTest::newRow("local import second") - << "import Qt 4.6\nimport \"subdir\"\n" - "Test {}" - << "QmlGraphicsRectangle"; - QTest::newRow("local import subsubdir") - << "import Qt 4.6\nimport \"subdir/subsubdir\"\n" - "SubTest {}" - << "QmlGraphicsRectangle"; - QTest::newRow("local import QTBUG-7721 A") - << "subdir.Test {}" // no longer allowed (QTBUG-7721) - << ""; - QTest::newRow("local import QTBUG-7721 B") - << "import \"subdir\" as X\n" - "X.subsubdir.SubTest {}" // no longer allowed (QTBUG-7721) - << ""; - QTest::newRow("local import as") - << "import \"subdir\" as T\n" - "T.Test {}" - << "QmlGraphicsRectangle"; - QTest::newRow("wrong local import as") - << "import \"subdir\" as T\n" - "Test {}" - << ""; - QTest::newRow("library precedence over local import") - << "import \"subdir\"\n" - "import com.nokia.Test 1.0\n" - "Test {}" - << "TestType"; -} - -void tst_qmllanguage::importsLocal() -{ - QFETCH(QString, qml); - QFETCH(QString, type); - testType(qml,type); -} - -void tst_qmllanguage::importsRemote_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("type"); - - QString serverdir = "http://127.0.0.1:14445/qtest/declarative/qmllanguage"; - - QTest::newRow("remote import") << "import \""+serverdir+"\"\nTest {}" << "QmlGraphicsRectangle"; - QTest::newRow("remote import with subdir") << "import \""+serverdir+"\"\nTestSubDir {}" << "QmlGraphicsText"; - QTest::newRow("remote import with local") << "import \""+serverdir+"\"\nTestLocal {}" << "QmlGraphicsImage"; -} - -#include "testhttpserver.h" - -void tst_qmllanguage::importsRemote() -{ - QFETCH(QString, qml); - QFETCH(QString, type); - - TestHTTPServer server(14445); - server.serveDirectory(SRCDIR); - - testType(qml,type); -} - -void tst_qmllanguage::importsInstalled_data() -{ - // QT-610 - - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("type"); - - // import installed - QTest::newRow("installed import 0") - << "import com.nokia.installedtest 0.0\n" - "InstalledTestTP {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import 0 as TP") - << "import com.nokia.installedtest 0.0 as TP\n" - "TP.InstalledTestTP {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import 1") - << "import com.nokia.installedtest 1.0\n" - "InstalledTest {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import 2") - << "import com.nokia.installedtest 1.3\n" - "InstalledTest {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import 3") - << "import com.nokia.installedtest 1.4\n" - "InstalledTest {}" - << "QmlGraphicsText"; - QTest::newRow("installed import 4") - << "import com.nokia.installedtest 1.10\n" - "InstalledTest {}" - << "QmlGraphicsText"; - QTest::newRow("installed import visibility") // QT-614 - << "import com.nokia.installedtest 1.4\n" - "PrivateType {}" - << ""; -} - -void tst_qmllanguage::importsInstalled() -{ - QFETCH(QString, qml); - QFETCH(QString, type); - testType(qml,type); -} - - -void tst_qmllanguage::importsOrder_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("type"); - - QTest::newRow("installed import overrides 1") << - "import com.nokia.installedtest 1.0\n" - "import com.nokia.installedtest 1.4\n" - "InstalledTest {}" - << "QmlGraphicsText"; - QTest::newRow("installed import overrides 2") << - "import com.nokia.installedtest 1.4\n" - "import com.nokia.installedtest 1.0\n" - "InstalledTest {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import re-overrides 1") << - "import com.nokia.installedtest 1.4\n" - "import com.nokia.installedtest 1.0\n" - "import com.nokia.installedtest 1.4\n" - "InstalledTest {}" - << "QmlGraphicsText"; - QTest::newRow("installed import re-overrides 2") << - "import com.nokia.installedtest 1.4\n" - "import com.nokia.installedtest 1.0\n" - "import com.nokia.installedtest 1.4\n" - "import com.nokia.installedtest 1.0\n" - "InstalledTest {}" - << "QmlGraphicsRectangle"; - - QTest::newRow("installed import versus builtin 1") << - "import com.nokia.installedtest 1.5\n" - "import Qt 4.6\n" - "Rectangle {}" - << "QmlGraphicsRectangle"; - QTest::newRow("installed import versus builtin 2") << - "import Qt 4.6\n" - "import com.nokia.installedtest 1.5\n" - "Rectangle {}" - << "QmlGraphicsText"; - QTest::newRow("namespaces cannot be overridden by types 1") << - "import Qt 4.6 as Rectangle\n" - "import com.nokia.installedtest 1.5\n" - "Rectangle {}" - << ""; - QTest::newRow("namespaces cannot be overridden by types 2") << - "import Qt 4.6 as Rectangle\n" - "import com.nokia.installedtest 1.5\n" - "Rectangle.Image {}" - << "QmlGraphicsImage"; -} - -void tst_qmllanguage::importsOrder() -{ - QFETCH(QString, qml); - QFETCH(QString, type); - testType(qml,type); -} - -void tst_qmllanguage::qmlAttachedPropertiesObjectMethod() -{ - QObject object; - - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, false), (QObject *)0); - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(&object, true), (QObject *)0); - - { - QmlComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.1.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qmlAttachedPropertiesObject<MyQmlObject>(object, false), (QObject *)0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); - } - - { - QmlComponent component(&engine, TEST_FILE("qmlAttachedPropertiesObjectMethod.2.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, false) != 0); - QVERIFY(qmlAttachedPropertiesObject<MyQmlObject>(object, true) != 0); - } -} - -void tst_qmllanguage::crash1() -{ - QmlComponent component(&engine); - component.setData("import Qt 4.6\nComponent {}", QUrl()); -} - -void tst_qmllanguage::crash2() -{ - QmlComponent component(&engine, TEST_FILE("crash2.qml")); -} - -QTEST_MAIN(tst_qmllanguage) - -#include "tst_qmllanguage.moc" diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro deleted file mode 100644 index b2145ed..0000000 --- a/tests/auto/declarative/qmllist/qmllist.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmllist.cpp diff --git a/tests/auto/declarative/qmllist/tst_qmllist.cpp b/tests/auto/declarative/qmllist/tst_qmllist.cpp deleted file mode 100644 index 76def1c..0000000 --- a/tests/auto/declarative/qmllist/tst_qmllist.cpp +++ /dev/null @@ -1,574 +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 <qtest.h> -#include <QUrl> -#include <QFileInfo> -#include <QDir> -#include <QmlEngine> -#include <QmlComponent> -#include <QtDeclarative/qml.h> -#include <QtDeclarative/qmlprivate.h> -#include <QDebug> - -inline QUrl TEST_FILE(const QString &filename) -{ - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath("data/" + filename)); -} - -inline QUrl TEST_FILE(const char *filename) -{ - return TEST_FILE(QLatin1String(filename)); -} - -class tst_QmlList : public QObject -{ - Q_OBJECT -public: - tst_QmlList() {} - -private slots: - void qmllistreference(); - void qmllistreference_invalid(); - void isValid(); - void object(); - void listElementType(); - void canAppend(); - void canAt(); - void canClear(); - void canCount(); - void append(); - void at(); - void clear(); - void count(); - void copy(); - void qmlmetaproperty(); - void engineTypes(); - void variantToList(); -}; - -class TestType : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlListProperty<TestType> data READ dataProperty); - Q_PROPERTY(int intProperty READ intProperty); - -public: - TestType() : property(this, data) {} - QmlListProperty<TestType> dataProperty() { return property; } - int intProperty() const { return 10; } - - QList<TestType *> data; - QmlListProperty<TestType> property; -}; -QML_DECLARE_TYPE(TestType); -QML_DEFINE_NOCREATE_TYPE(TestType); - -void tst_QmlList::qmllistreference() -{ - TestType tt; - - QmlListReference r(&tt, "data"); - QVERIFY(r.isValid() == true); - QCOMPARE(r.count(), 0); - - tt.data.append(&tt); - QCOMPARE(r.count(), 1); -} - -void tst_QmlList::qmllistreference_invalid() -{ - TestType tt; - - // Invalid - { - QmlListReference r; - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } - - // Non-property - { - QmlListReference r(&tt, "blah"); - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } - - // Non-list property - { - QmlListReference r(&tt, "intProperty"); - QVERIFY(r.isValid() == false); - QVERIFY(r.object() == 0); - QVERIFY(r.listElementType() == 0); - QVERIFY(r.canAt() == false); - QVERIFY(r.canClear() == false); - QVERIFY(r.canCount() == false); - QVERIFY(r.append(0) == false); - QVERIFY(r.at(10) == 0); - QVERIFY(r.clear() == false); - QVERIFY(r.count() == 0); - } -} - -void tst_QmlList::isValid() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.isValid() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.isValid() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.isValid() == true); - delete tt; - QVERIFY(ref.isValid() == false); - } -} - -void tst_QmlList::object() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.object() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.object() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.object() == tt); - delete tt; - QVERIFY(ref.object() == 0); - } -} - -void tst_QmlList::listElementType() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.listElementType() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.listElementType() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.listElementType() == &TestType::staticMetaObject); - delete tt; - QVERIFY(ref.listElementType() == 0); - } -} - -void tst_QmlList::canAppend() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canAppend() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canAppend() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canAppend() == true); - delete tt; - QVERIFY(ref.canAppend() == false); - } - - { - TestType tt; - tt.property.append = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canAppend() == false); - } -} - -void tst_QmlList::canAt() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canAt() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canAt() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canAt() == true); - delete tt; - QVERIFY(ref.canAt() == false); - } - - { - TestType tt; - tt.property.at = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canAt() == false); - } -} - -void tst_QmlList::canClear() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canClear() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canClear() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canClear() == true); - delete tt; - QVERIFY(ref.canClear() == false); - } - - { - TestType tt; - tt.property.clear = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canClear() == false); - } -} - -void tst_QmlList::canCount() -{ - TestType *tt = new TestType; - - { - QmlListReference ref; - QVERIFY(ref.canCount() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.canCount() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.canCount() == true); - delete tt; - QVERIFY(ref.canCount() == false); - } - - { - TestType tt; - tt.property.count = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.canCount() == false); - } -} - -void tst_QmlList::append() -{ - TestType *tt = new TestType; - QObject object; - - { - QmlListReference ref; - QVERIFY(ref.append(tt) == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.append(tt) == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.append(tt) == true); - QVERIFY(tt->data.count() == 1); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(ref.append(&object) == false); - QVERIFY(tt->data.count() == 1); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(ref.append(0) == true); - QVERIFY(tt->data.count() == 2); - QVERIFY(tt->data.at(0) == tt); - QVERIFY(tt->data.at(1) == 0); - delete tt; - QVERIFY(ref.append(0) == false); - } - - { - TestType tt; - tt.property.append = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.append(&tt) == false); - } -} - -void tst_QmlList::at() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.at(0) == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.at(0) == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.at(0) == tt); - QVERIFY(ref.at(1) == 0); - QVERIFY(ref.at(2) == tt); - delete tt; - QVERIFY(ref.at(0) == 0); - } - - { - TestType tt; - tt.data.append(&tt); - tt.property.at = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.at(0) == 0); - } -} - -void tst_QmlList::clear() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.clear() == false); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.clear() == false); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.clear() == true); - QVERIFY(tt->data.count() == 0); - delete tt; - QVERIFY(ref.clear() == false); - } - - { - TestType tt; - tt.property.clear = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.clear() == false); - } -} - -void tst_QmlList::count() -{ - TestType *tt = new TestType; - tt->data.append(tt); - tt->data.append(0); - tt->data.append(tt); - - { - QmlListReference ref; - QVERIFY(ref.count() == 0); - } - - { - QmlListReference ref(tt, "blah"); - QVERIFY(ref.count() == 0); - } - - { - QmlListReference ref(tt, "data"); - QVERIFY(ref.count() == 3); - tt->data.removeAt(1); - QVERIFY(ref.count() == 2); - delete tt; - QVERIFY(ref.count() == 0); - } - - { - TestType tt; - tt.data.append(&tt); - tt.property.count = 0; - QmlListReference ref(&tt, "data"); - QVERIFY(ref.count() == 0); - } -} - -void tst_QmlList::copy() -{ - TestType tt; - tt.data.append(&tt); - tt.data.append(0); - tt.data.append(&tt); - - QmlListReference *r1 = new QmlListReference(&tt, "data"); - QVERIFY(r1->count() == 3); - - QmlListReference r2(*r1); - QmlListReference r3; - r3 = *r1; - - QVERIFY(r2.count() == 3); - QVERIFY(r3.count() == 3); - - delete r1; - - QVERIFY(r2.count() == 3); - QVERIFY(r3.count() == 3); - - tt.data.removeAt(2); - - QVERIFY(r2.count() == 2); - QVERIFY(r3.count() == 2); -} - -void tst_QmlList::qmlmetaproperty() -{ - TestType tt; - tt.data.append(&tt); - tt.data.append(0); - tt.data.append(&tt); - - QmlMetaProperty prop(&tt, QLatin1String("data")); - QVariant v = prop.read(); - QVERIFY(v.userType() == qMetaTypeId<QmlListReference>()); - QmlListReference ref = qvariant_cast<QmlListReference>(v); - QVERIFY(ref.count() == 3); - QVERIFY(ref.listElementType() == &TestType::staticMetaObject); -} - -void tst_QmlList::engineTypes() -{ - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("engineTypes.qml")); - - QObject *o = component.create(); - QVERIFY(o); - - QmlMetaProperty p1(o, QLatin1String("myList")); - QVERIFY(p1.propertyCategory() == QmlMetaProperty::Normal); - - QmlMetaProperty p2(o, QLatin1String("myList"), engine.rootContext()); - QVERIFY(p2.propertyCategory() == QmlMetaProperty::List); - QVariant v = p2.read(); - QVERIFY(v.userType() == qMetaTypeId<QmlListReference>()); - QmlListReference ref = qvariant_cast<QmlListReference>(v); - QVERIFY(ref.count() == 2); - QVERIFY(ref.listElementType()); - QVERIFY(ref.listElementType() != &QObject::staticMetaObject); - - delete o; -} - -void tst_QmlList::variantToList() -{ - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("variantToList.qml")); - - QObject *o = component.create(); - QVERIFY(o); - - QVERIFY(o->property("value").userType() == qMetaTypeId<QmlListReference>()); - QCOMPARE(o->property("test").toInt(), 1); - - delete o; -} - -QTEST_MAIN(tst_QmlList) - -#include "tst_qmllist.moc" diff --git a/tests/auto/declarative/qmllistmodel/qmllistmodel.pro b/tests/auto/declarative/qmllistmodel/qmllistmodel.pro deleted file mode 100644 index 60b0c4b..0000000 --- a/tests/auto/declarative/qmllistmodel/qmllistmodel.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -QT += script -macx:CONFIG -= app_bundle - -SOURCES += tst_qmllistmodel.cpp diff --git a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp b/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp deleted file mode 100644 index e70c7f1..0000000 --- a/tests/auto/declarative/qmllistmodel/tst_qmllistmodel.cpp +++ /dev/null @@ -1,338 +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 <qtest.h> -#include <QtDeclarative/private/qmllistmodel_p.h> -#include <QtDeclarative/private/qmlexpression_p.h> -#include <QmlComponent> -#include <QDebug> - -class tst_QmlListModel : public QObject -{ - Q_OBJECT -public: - tst_QmlListModel() {} - -private slots: - void static_types(); - void static_types_data(); - void static_i18n(); - void static_nestedElements(); - void static_nestedElements_data(); - void dynamic_data(); - void dynamic(); - void error_data(); - void error(); -}; - -void tst_QmlListModel::static_i18n() -{ - QString expect = QString::fromUtf8("na\303\257ve"); - QString componentStr = "import Qt 4.6\nListModel { ListElement { prop1: \""+expect+"\" } }"; - QmlEngine engine; - QmlComponent component(&engine); - component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); - QmlListModel *obj = qobject_cast<QmlListModel*>(component.create()); - QVERIFY(obj != 0); - QString prop = obj->get(0).property(QLatin1String("prop1")).toString(); - QCOMPARE(prop,expect); - delete obj; -} - -void tst_QmlListModel::static_nestedElements() -{ - QFETCH(int, elementCount); - - QStringList elements; - for (int i=0; i<elementCount; i++) - elements.append("ListElement { a: 1; b: 2 }"); - QString elementsStr = elements.join(",\n") + "\n"; - - QString componentStr = - "import Qt 4.6\n" - "ListModel {\n" - " ListElement {\n" - " attributes: [\n"; - componentStr += elementsStr.toUtf8().constData(); - componentStr += - " ]\n" - " }\n" - "}"; - - QmlEngine engine; - QmlComponent component(&engine); - component.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); - - QmlListModel *obj = qobject_cast<QmlListModel*>(component.create()); - QVERIFY(obj != 0); - - QScriptValue prop = obj->get(0).property(QLatin1String("attributes")).property(QLatin1String("count")); - QVERIFY(prop.isNumber()); - QCOMPARE(prop.toInt32(), qint32(elementCount)); - - delete obj; -} - -void tst_QmlListModel::static_nestedElements_data() -{ - QTest::addColumn<int>("elementCount"); - - QTest::newRow("0 items") << 0; - QTest::newRow("1 item") << 1; - QTest::newRow("2 items") << 2; - QTest::newRow("many items") << 5; -} - -void tst_QmlListModel::dynamic_data() -{ - QTest::addColumn<QString>("script"); - QTest::addColumn<int>("result"); - QTest::addColumn<QString>("warning"); - - // Simple flat model - - QTest::newRow("count") << "count" << 0 << ""; - - QTest::newRow("get1") << "{get(0)}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; - QTest::newRow("get2") << "{get(-1)}" << 0 << "QML ListModel (unknown location) get: index -1 out of range"; - - QTest::newRow("append1") << "{append({'foo':123});count}" << 1 << ""; - QTest::newRow("append2") << "{append({'foo':123,'bar':456});count}" << 1 << ""; - QTest::newRow("append3a") << "{append({'foo':123});append({'foo':456});get(0).foo}" << 123 << ""; - QTest::newRow("append3b") << "{append({'foo':123});append({'foo':456});get(1).foo}" << 456 << ""; - QTest::newRow("append4a") << "{append(123)}" << 0 << "QML ListModel (unknown location) append: value is not an object"; - QTest::newRow("append4b") << "{append([1,2,3])}" << 0 << "QML ListModel (unknown location) append: value is not an object"; - - QTest::newRow("clear1") << "{append({'foo':456});clear();count}" << 0 << ""; - QTest::newRow("clear2") << "{append({'foo':123});append({'foo':456});clear();count}" << 0 << ""; - QTest::newRow("clear2") << "{append({'foo':123});clear();get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; - - QTest::newRow("remove1") << "{append({'foo':123});remove(0);count}" << 0 << ""; - QTest::newRow("remove2a") << "{append({'foo':123});append({'foo':456});remove(0);count}" << 1 << ""; - QTest::newRow("remove2b") << "{append({'foo':123});append({'foo':456});remove(0);get(0).foo}" << 456 << ""; - QTest::newRow("remove2c") << "{append({'foo':123});append({'foo':456});remove(1);get(0).foo}" << 123 << ""; - QTest::newRow("remove3") << "{append({'foo':123});remove(0);get(0).foo}" << 0 << "QML ListModel (unknown location) get: index 0 out of range"; - QTest::newRow("remove3a") << "{append({'foo':123});remove(-1)}" << 0 << "QML ListModel (unknown location) remove: index -1 out of range"; - QTest::newRow("remove4a") << "{remove(0)}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range"; - QTest::newRow("remove4b") << "{append({'foo':123});remove(0);remove(0)}" << 0 << "QML ListModel (unknown location) remove: index 0 out of range"; - QTest::newRow("remove4c") << "{append({'foo':123});remove(1)}" << 0 << "QML ListModel (unknown location) remove: index 1 out of range"; - - QTest::newRow("insert1") << "{insert(0,{'foo':123});count}" << 1 << ""; - QTest::newRow("insert2") << "{insert(1,{'foo':123});count}" << 0 << "QML ListModel (unknown location) insert: index 1 out of range"; - QTest::newRow("insert3a") << "{append({'foo':123});insert(1,{'foo':456});count}" << 2 << ""; - QTest::newRow("insert3b") << "{append({'foo':123});insert(1,{'foo':456});get(0).foo}" << 123 << ""; - QTest::newRow("insert3c") << "{append({'foo':123});insert(1,{'foo':456});get(1).foo}" << 456 << ""; - QTest::newRow("insert3d") << "{append({'foo':123});insert(0,{'foo':456});get(0).foo}" << 456 << ""; - QTest::newRow("insert3e") << "{append({'foo':123});insert(0,{'foo':456});get(1).foo}" << 123 << ""; - QTest::newRow("insert4") << "{append({'foo':123});insert(-1,{'foo':456})}" << 0 << "QML ListModel (unknown location) insert: index -1 out of range"; - QTest::newRow("insert5a") << "{insert(0,123)}" << 0 << "QML ListModel (unknown location) insert: value is not an object"; - QTest::newRow("insert5b") << "{insert(0,[1,2,3])}" << 0 << "QML ListModel (unknown location) insert: value is not an object"; - - QTest::newRow("set1") << "{append({'foo':123});set(0,{'foo':456});count}" << 1 << ""; - QTest::newRow("set2") << "{append({'foo':123});set(0,{'foo':456});get(0).foo}" << 456 << ""; - QTest::newRow("set3a") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).foo}" << 999 << ""; - QTest::newRow("set3b") << "{append({'foo':123,'bar':456});set(0,{'foo':999});get(0).bar}" << 456 << ""; - QTest::newRow("set4a") << "{set(0,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index 0 out of range"; - QTest::newRow("set4c") << "{set(-1,{'foo':456})}" << 0 << "QML ListModel (unknown location) set: index -1 out of range"; - QTest::newRow("set5a") << "{append({'foo':123,'bar':456});set(0,123)}" << 0 << "QML ListModel (unknown location) set: value is not an object"; - QTest::newRow("set5b") << "{append({'foo':123,'bar':456});set(0,[1,2,3])}" << 0 << "QML ListModel (unknown location) set: value is not an object"; - QTest::newRow("set6") << "{append({'foo':123});set(1,{'foo':456});count}" << 2 << ""; - - QTest::newRow("setprop1") << "{append({'foo':123});setProperty(0,'foo',456);count}" << 1 << ""; - QTest::newRow("setprop2") << "{append({'foo':123});setProperty(0,'foo',456);get(0).foo}" << 456 << ""; - QTest::newRow("setprop3a") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).foo}" << 999 << ""; - QTest::newRow("setprop3b") << "{append({'foo':123,'bar':456});setProperty(0,'foo',999);get(0).bar}" << 456 << ""; - QTest::newRow("setprop4a") << "{setProperty(0,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index 0 out of range"; - QTest::newRow("setprop4b") << "{setProperty(-1,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index -1 out of range"; - QTest::newRow("setprop4c") << "{append({'foo':123,'bar':456});setProperty(1,'foo',456)}" << 0 << "QML ListModel (unknown location) set: index 1 out of range"; - QTest::newRow("setprop5") << "{append({'foo':123,'bar':456});append({'foo':111});setProperty(1,'bar',222);get(1).bar}" << 222 << ""; - - QTest::newRow("move1a") << "{append({'foo':123});append({'foo':456});move(0,1,1);count}" << 2 << ""; - QTest::newRow("move1b") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(0).foo}" << 456 << ""; - QTest::newRow("move1c") << "{append({'foo':123});append({'foo':456});move(0,1,1);get(1).foo}" << 123 << ""; - QTest::newRow("move1d") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(0).foo}" << 456 << ""; - QTest::newRow("move1e") << "{append({'foo':123});append({'foo':456});move(1,0,1);get(1).foo}" << 123 << ""; - QTest::newRow("move2a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);count}" << 3 << ""; - QTest::newRow("move2b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(0).foo}" << 789 << ""; - QTest::newRow("move2c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(1).foo}" << 123 << ""; - QTest::newRow("move2d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,1,2);get(2).foo}" << 456 << ""; - QTest::newRow("move3a") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,3)}" << 0 << "QML ListModel (unknown location) move: out of range"; - QTest::newRow("move3b") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,-1,1)}" << 0 << "QML ListModel (unknown location) move: out of range"; - QTest::newRow("move3c") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(1,0,-1)}" << 0 << "QML ListModel (unknown location) move: out of range"; - QTest::newRow("move3d") << "{append({'foo':123});append({'foo':456});append({'foo':789});move(0,3,1)}" << 0 << "QML ListModel (unknown location) move: out of range"; - - // Structured model - - QTest::newRow("listprop1a") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});count}" << 1 << ""; - QTest::newRow("listprop1b") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.get(1).a}" << 2 << ""; - QTest::newRow("listprop2a") << "{append({'foo':123,'bars':[{'a':1},{'a':2},{'a':3}]});get(0).bars.append({'a':4});get(0).bars.get(3).a}" << 4 << ""; -} - -void tst_QmlListModel::dynamic() -{ - QFETCH(QString, script); - QFETCH(int, result); - QFETCH(QString, warning); - - QmlEngine engine; - QmlListModel model; - QmlEngine::setContextForObject(&model,engine.rootContext()); - engine.rootContext()->addDefaultObject(&model); - QmlExpression e(engine.rootContext(), script, &model); - if (!warning.isEmpty()) - QTest::ignoreMessage(QtWarningMsg, warning.toLatin1()); - int actual = e.value().toInt(); - if (e.hasError()) - qDebug() << e.error(); // errors not expected - QVERIFY(!e.hasError()); - QCOMPARE(actual,result); -} - -void tst_QmlListModel::static_types_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QVariant>("value"); - - QTest::newRow("string") - << "ListElement { foo: \"bar\" }" - << QVariant(QString("bar")); - - QTest::newRow("real") - << "ListElement { foo: 10.5 }" - << QVariant(10.5); - - QTest::newRow("real0") - << "ListElement { foo: 0 }" - << QVariant(double(0)); - - QTest::newRow("bool") - << "ListElement { foo: false }" - << QVariant(false); - - QTest::newRow("bool") - << "ListElement { foo: true }" - << QVariant(true); -} - -void tst_QmlListModel::static_types() -{ - QFETCH(QString, qml); - QFETCH(QVariant, value); - - qml = "import Qt 4.6\nListModel { " + qml + " }"; - - QmlEngine engine; - QmlComponent component(&engine); - component.setData(qml.toUtf8(), - QUrl::fromLocalFile(QString("dummy.qml"))); - QVERIFY(!component.isError()); - - QmlListModel *obj = qobject_cast<QmlListModel*>(component.create()); - QVERIFY(obj != 0); - - QScriptValue actual = obj->get(0).property(QLatin1String("foo")); - - QCOMPARE(actual.isString(), value.type() == QVariant::String); - QCOMPARE(actual.isBoolean(), value.type() == QVariant::Bool); - QCOMPARE(actual.isNumber(), value.type() == QVariant::Double); - - QCOMPARE(actual.toString(), value.toString()); - - delete obj; -} - -void tst_QmlListModel::error_data() -{ - QTest::addColumn<QString>("qml"); - QTest::addColumn<QString>("error"); - - QTest::newRow("id not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { id: fred } }" - << "ListElement: cannot use reserved \"id\" property"; - - QTest::newRow("id allowed in ListModel") - << "import Qt 4.6\nListModel { id:model }" - << ""; - - QTest::newRow("random properties not allowed in ListModel") - << "import Qt 4.6\nListModel { foo:123 }" - << "ListModel: undefined property 'foo'"; - - QTest::newRow("random properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo:123 } }" - << ""; - - QTest::newRow("bindings not allowed in ListElement") - << "import Qt 4.6\nRectangle { id: rect; ListModel { ListElement { foo: rect.color } } }" - << "ListElement: cannot use script for property value"; - - QTest::newRow("random object list properties allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { foo: [ ListElement { bar: 123 } ] } }" - << ""; - - QTest::newRow("default properties not allowed in ListElement") - << "import Qt 4.6\nListModel { ListElement { Item { } } }" - << "QTBUG-6082 ListElement should not allow child objects"; -} - -void tst_QmlListModel::error() -{ - QFETCH(QString, qml); - QFETCH(QString, error); - - QmlEngine engine; - QmlComponent component(&engine); - component.setData(qml.toUtf8(), - QUrl::fromLocalFile(QString("dummy.qml"))); - if (error.isEmpty()) { - QVERIFY(!component.isError()); - } else { - if (error.startsWith(QLatin1String("QTBUG-"))) - QEXPECT_FAIL("",error.toLatin1(),Abort); - QVERIFY(component.isError()); - QList<QmlError> errors = component.errors(); - QCOMPARE(errors.count(),1); - QCOMPARE(errors.at(0).description(),error); - } -} - -QTEST_MAIN(tst_QmlListModel) - -#include "tst_qmllistmodel.moc" diff --git a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro deleted file mode 100644 index 542c14e..0000000 --- a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlmetaproperty.cpp diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp deleted file mode 100644 index 050cd3f..0000000 --- a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ /dev/null @@ -1,1136 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QtDeclarative/qmlmetaproperty.h> -#include <private/qguard_p.h> -#include <QtDeclarative/qmlbinding.h> -#include <QtGui/QLineEdit> - -class MyQmlObject : public QObject -{ - Q_OBJECT -public: - MyQmlObject() {} -}; - -QML_DECLARE_TYPE(MyQmlObject); -QML_DEFINE_TYPE(Test,1,0,MyQmlObject,MyQmlObject); - -class MyAttached : public QObject -{ - Q_OBJECT - Q_PROPERTY(int foo READ foo WRITE setFoo) -public: - MyAttached(QObject *parent) : QObject(parent), m_foo(13) {} - - int foo() const { return m_foo; } - void setFoo(int f) { m_foo = f; } - -private: - int m_foo; -}; - -class MyContainer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlListProperty<MyQmlObject> children READ children) -public: - MyContainer() {} - - QmlListProperty<MyQmlObject> children() { return QmlListProperty<MyQmlObject>(this, m_children); } - - static MyAttached *qmlAttachedProperties(QObject *o) { - return new MyAttached(o); - } - -private: - QList<MyQmlObject*> m_children; -}; - -QML_DECLARE_TYPE(MyContainer); -QML_DEFINE_TYPE(Test,1,0,MyContainer,MyContainer); -QML_DECLARE_TYPEINFO(MyContainer, QML_HAS_ATTACHED_PROPERTIES) - -class tst_qmlmetaproperty : public QObject -{ - Q_OBJECT -public: - tst_qmlmetaproperty() {} - -private slots: - - // Constructors - void qmlmetaproperty(); - void qmlmetaproperty_object(); - void qmlmetaproperty_object_string(); - void qmlmetaproperty_object_context(); - void qmlmetaproperty_object_string_context(); - - // Methods - void name(); - void read(); - void write(); - void reset(); - - // Functionality - void writeObjectToList(); - void writeListToList(); - - //writeToReadOnly(); - - // Bugs - void crashOnValueProperty(); - -private: - QmlEngine engine; -}; - -void tst_qmlmetaproperty::qmlmetaproperty() -{ - QmlMetaProperty prop; - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString()); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Invalid); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; -} - -class PropertyObject : public QObject -{ - Q_OBJECT - Q_PROPERTY(int defaultProperty READ defaultProperty); - Q_PROPERTY(QRect rectProperty READ rectProperty); - Q_PROPERTY(QRect wrectProperty READ wrectProperty WRITE setWRectProperty); - Q_PROPERTY(QUrl url READ url WRITE setUrl); - Q_PROPERTY(int resettableProperty READ resettableProperty WRITE setResettableProperty RESET resetProperty); - - Q_CLASSINFO("DefaultProperty", "defaultProperty"); -public: - PropertyObject() : m_resetProperty(9) {} - - int defaultProperty() { return 10; } - QRect rectProperty() { return QRect(10, 10, 1, 209); } - - QRect wrectProperty() { return m_rect; } - void setWRectProperty(const QRect &r) { m_rect = r; } - - QUrl url() { return m_url; } - void setUrl(const QUrl &u) { m_url = u; } - - int resettableProperty() const { return m_resetProperty; } - void setResettableProperty(int r) { m_resetProperty = r; } - void resetProperty() { m_resetProperty = 9; } - -signals: - void clicked(); - -private: - int m_resetProperty; - QRect m_rect; - QUrl m_url; -}; - -QML_DECLARE_TYPE(PropertyObject); -QML_DEFINE_TYPE(Test,1,0,PropertyObject,PropertyObject); - -void tst_qmlmetaproperty::qmlmetaproperty_object() -{ - QObject object; // Has no default property - PropertyObject dobject; // Has default property - - { - QmlMetaProperty prop(&object); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString()); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Invalid); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("defaultProperty")); - QCOMPARE(prop.read(), QVariant(10)); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), (QmlMetaProperty::Type)(QmlMetaProperty::Property | QmlMetaProperty::Default)); - QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), true); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), true); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::Normal); - QCOMPARE(prop.propertyType(), (int)QVariant::Int); - QCOMPARE(prop.propertyTypeName(), "int"); - QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } -} - -void tst_qmlmetaproperty::qmlmetaproperty_object_string() -{ - QObject object; - PropertyObject dobject; - - { - QmlMetaProperty prop(&object, QString("defaultProperty")); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString()); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Invalid); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject, QString("defaultProperty")); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("defaultProperty")); - QCOMPARE(prop.read(), QVariant(10)); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Property); - QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), true); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::Normal); - QCOMPARE(prop.propertyType(), (int)QVariant::Int); - QCOMPARE(prop.propertyTypeName(), "int"); - QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject, QString("onClicked")); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("onClicked")); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QCOMPARE(QString(prop.method().signature()), QString("clicked()")); - QCOMPARE(prop.type(), QmlMetaProperty::SignalProperty); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } -} - -void tst_qmlmetaproperty::qmlmetaproperty_object_context() -{ - QObject object; // Has no default property - PropertyObject dobject; // Has default property - - { - QmlMetaProperty prop(&object, engine.rootContext()); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString()); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Invalid); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject, engine.rootContext()); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("defaultProperty")); - QCOMPARE(prop.read(), QVariant(10)); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), (QmlMetaProperty::Type)(QmlMetaProperty::Property | QmlMetaProperty::Default)); - QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), true); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), true); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::Normal); - QCOMPARE(prop.propertyType(), (int)QVariant::Int); - QCOMPARE(prop.propertyTypeName(), "int"); - QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } -} - -void tst_qmlmetaproperty::qmlmetaproperty_object_string_context() -{ - QObject object; - PropertyObject dobject; - - { - QmlMetaProperty prop(&object, QString("defaultProperty"), engine.rootContext()); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString()); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Invalid); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), false); - QCOMPARE(prop.object(), (QObject *)0); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QVERIFY(prop.property().name() == 0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), -1); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject, QString("defaultProperty"), engine.rootContext()); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("defaultProperty")); - QCOMPARE(prop.read(), QVariant(10)); - QCOMPARE(prop.write(QVariant()), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), true); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QVERIFY(prop.method().signature() == 0); - QCOMPARE(prop.type(), QmlMetaProperty::Property); - QCOMPARE(prop.isProperty(), true); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), true); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::Normal); - QCOMPARE(prop.propertyType(), (int)QVariant::Int); - QCOMPARE(prop.propertyTypeName(), "int"); - QCOMPARE(QString(prop.property().name()), QString("defaultProperty")); - QVERIFY(prop.binding() == 0); - QTest::ignoreMessage(QtWarningMsg, "<Unknown File>:-1: Unable to assign null to int"); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding != 0); - QVERIFY(prop.binding() == binding); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression == 0); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfProperty("defaultProperty")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } - - { - QmlMetaProperty prop(&dobject, QString("onClicked"), engine.rootContext()); - - QGuard<QmlBinding> binding(new QmlBinding(QString(), 0, 0)); - binding->setTarget(prop); - QVERIFY(binding != 0); - QGuard<QmlExpression> expression(new QmlExpression()); - QVERIFY(expression != 0); - - QObject *obj = new QObject; - - QCOMPARE(prop.name(), QString("onClicked")); - QCOMPARE(prop.read(), QVariant()); - QCOMPARE(prop.write(QVariant("Hello")), false); - QCOMPARE(prop.hasChangedNotifier(), false); - QCOMPARE(prop.needsChangedNotifier(), false); - QCOMPARE(prop.connectNotifier(0, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, SLOT(deleteLater())), false); - QCOMPARE(prop.connectNotifier(obj, 0), false); - QCOMPARE(prop.connectNotifier(0, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, obj->metaObject()->indexOfMethod("deleteLater()")), false); - QCOMPARE(prop.connectNotifier(obj, -1), false); - QCOMPARE(QString(prop.method().signature()), QString("clicked()")); - QCOMPARE(prop.type(), QmlMetaProperty::SignalProperty); - QCOMPARE(prop.isProperty(), false); - QCOMPARE(prop.isDefault(), false); - QCOMPARE(prop.isWritable(), false); - QCOMPARE(prop.isDesignable(), false); - QCOMPARE(prop.isResettable(), false); - QCOMPARE(prop.isValid(), true); - QCOMPARE(prop.object(), &dobject); - QCOMPARE(prop.propertyCategory(), QmlMetaProperty::InvalidProperty); - QCOMPARE(prop.propertyType(), 0); - QCOMPARE(prop.propertyTypeName(), (const char *)0); - QCOMPARE(prop.property().name(), (const char *)0); - QVERIFY(prop.binding() == 0); - QVERIFY(prop.setBinding(binding) == 0); - QVERIFY(binding == 0); - QVERIFY(prop.signalExpression() == 0); - QVERIFY(prop.setSignalExpression(expression) == 0); - QVERIFY(expression != 0); - QVERIFY(prop.signalExpression() == expression); - QCOMPARE(prop.coreIndex(), dobject.metaObject()->indexOfMethod("clicked()")); - QCOMPARE(prop.valueTypeCoreIndex(), -1); - - delete obj; - } -} - -void tst_qmlmetaproperty::name() -{ - { - QmlMetaProperty p; - QCOMPARE(p.name(), QString()); - } - - { - PropertyObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.name(), QString("defaultProperty")); - } - - { - QObject o; - QmlMetaProperty p(&o, QString("objectName")); - QCOMPARE(p.name(), QString("objectName")); - } - - { - PropertyObject o; - QmlMetaProperty p(&o, "onClicked"); - QCOMPARE(p.name(), QString("onClicked")); - } - - { - QObject o; - QmlMetaProperty p(&o, "onClicked"); - QCOMPARE(p.name(), QString()); - } - - { - QObject o; - QmlMetaProperty p(&o, "foo"); - QCOMPARE(p.name(), QString()); - } - - { - QmlMetaProperty p(0, "foo"); - QCOMPARE(p.name(), QString()); - } - - { - PropertyObject o; - QmlMetaProperty p = QmlMetaProperty::createProperty(&o, "rectProperty"); - QCOMPARE(p.name(), QString("rectProperty")); - } - - { - PropertyObject o; - QmlMetaProperty p = QmlMetaProperty::createProperty(&o, "rectProperty.x"); - QCOMPARE(p.name(), QString("rectProperty.x")); - } - - { - PropertyObject o; - QmlMetaProperty p = QmlMetaProperty::createProperty(&o, "rectProperty.foo"); - QCOMPARE(p.name(), QString()); - } -} - -void tst_qmlmetaproperty::read() -{ - // Invalid - { - QmlMetaProperty p; - QCOMPARE(p.read(), QVariant()); - } - - // Default prop - { - PropertyObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.read(), QVariant(10)); - } - - // Invalid default prop - { - QObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.read(), QVariant()); - } - - // Value prop by name - { - QObject o; - - QmlMetaProperty p(&o, "objectName"); - QCOMPARE(p.read(), QVariant(QString())); - - o.setObjectName("myName"); - - QCOMPARE(p.read(), QVariant("myName")); - } - - // Value-type prop - { - PropertyObject o; - QmlMetaProperty p = QmlMetaProperty::createProperty(&o, "rectProperty.x"); - QCOMPARE(p.read(), QVariant(10)); - } - - // Invalid value-type prop - { - PropertyObject o; - QmlMetaProperty p = QmlMetaProperty::createProperty(&o, "rectProperty.foo"); - QCOMPARE(p.read(), QVariant()); - } - - // Signal property - { - PropertyObject o; - QmlMetaProperty p(&o, "onClicked"); - QCOMPARE(p.read(), QVariant()); - - QVERIFY(0 == p.setSignalExpression(new QmlExpression())); - QVERIFY(0 != p.signalExpression()); - - QCOMPARE(p.read(), QVariant()); - } - - // Deleted object - { - PropertyObject *o = new PropertyObject; - QmlMetaProperty p = QmlMetaProperty::createProperty(o, "rectProperty.x"); - QCOMPARE(p.read(), QVariant(10)); - delete o; - QCOMPARE(p.read(), QVariant()); - } - - // Attached property - { - QmlComponent component(&engine); - component.setData("import Test 1.0\nMyContainer { }", QUrl()); - QObject *object = component.create(); - QVERIFY(object != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); - QCOMPARE(p.read(), QVariant(13)); - delete object; - } - { - QmlComponent component(&engine); - component.setData("import Test 1.0\nMyContainer { MyContainer.foo: 10 }", QUrl()); - QObject *object = component.create(); - QVERIFY(object != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); - QCOMPARE(p.read(), QVariant(10)); - delete object; - } - { - QmlComponent component(&engine); - component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); - QObject *object = component.create(); - QVERIFY(object != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); - QCOMPARE(p.read(), QVariant(10)); - delete object; - } -} - -void tst_qmlmetaproperty::write() -{ - // Invalid - { - QmlMetaProperty p; - QCOMPARE(p.write(QVariant(10)), false); - } - - // Read-only default prop - { - PropertyObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.write(QVariant(10)), false); - } - - // Invalid default prop - { - QObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.write(QVariant(10)), false); - } - - // Read-only prop by name - { - PropertyObject o; - QmlMetaProperty p(&o, QString("defaultProperty")); - QCOMPARE(p.write(QVariant(10)), false); - } - - // Writable prop by name - { - PropertyObject o; - QmlMetaProperty p(&o, QString("objectName")); - QCOMPARE(o.objectName(), QString()); - QCOMPARE(p.write(QVariant(QString("myName"))), true); - QCOMPARE(o.objectName(), QString("myName")); - } - - // Deleted object - { - PropertyObject *o = new PropertyObject; - QmlMetaProperty p(o, QString("objectName")); - QCOMPARE(p.write(QVariant(QString("myName"))), true); - QCOMPARE(o->objectName(), QString("myName")); - - delete o; - - QCOMPARE(p.write(QVariant(QString("myName"))), false); - } - - // Signal property - { - PropertyObject o; - QmlMetaProperty p(&o, "onClicked"); - QCOMPARE(p.write(QVariant("console.log(1921)")), false); - - QVERIFY(0 == p.setSignalExpression(new QmlExpression())); - QVERIFY(0 != p.signalExpression()); - - QCOMPARE(p.write(QVariant("console.log(1921)")), false); - - QVERIFY(0 != p.signalExpression()); - } - - // Value-type property - { - PropertyObject o; - QmlMetaProperty p(&o, "wrectProperty"); - - QCOMPARE(o.wrectProperty(), QRect()); - QCOMPARE(p.write(QRect(1, 13, 99, 8)), true); - QCOMPARE(o.wrectProperty(), QRect(1, 13, 99, 8)); - - QmlMetaProperty p2 = QmlMetaProperty::createProperty(&o, "wrectProperty.x"); - QCOMPARE(p2.read(), QVariant(1)); - QCOMPARE(p2.write(QVariant(6)), true); - QCOMPARE(p2.read(), QVariant(6)); - QCOMPARE(o.wrectProperty(), QRect(6, 13, 99, 8)); - } - - // URL-property - { - PropertyObject o; - QmlMetaProperty p(&o, "url"); - - QCOMPARE(p.write(QUrl("main.qml")), true); - QCOMPARE(o.url(), QUrl("main.qml")); - - QmlMetaProperty p2(&o, "url", engine.rootContext()); - - QUrl result = engine.baseUrl().resolved(QUrl("main.qml")); - QVERIFY(result != QUrl("main.qml")); - - QCOMPARE(p2.write(QUrl("main.qml")), true); - QCOMPARE(o.url(), result); - } - - // Attached property - { - QmlComponent component(&engine); - component.setData("import Test 1.0\nMyContainer { }", QUrl()); - QObject *object = component.create(); - QVERIFY(object != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "MyContainer.foo", qmlContext(object)); - p.write(QVariant(99)); - QCOMPARE(p.read(), QVariant(99)); - delete object; - } - { - QmlComponent component(&engine); - component.setData("import Test 1.0 as Foo\nFoo.MyContainer { Foo.MyContainer.foo: 10 }", QUrl()); - QObject *object = component.create(); - QVERIFY(object != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(object, "Foo.MyContainer.foo", qmlContext(object)); - p.write(QVariant(99)); - QCOMPARE(p.read(), QVariant(99)); - delete object; - } -} - -void tst_qmlmetaproperty::reset() -{ - // Invalid - { - QmlMetaProperty p; - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } - - // Read-only default prop - { - PropertyObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } - - // Invalid default prop - { - QObject o; - QmlMetaProperty p(&o); - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } - - // Non-resettable-only prop by name - { - PropertyObject o; - QmlMetaProperty p(&o, QString("defaultProperty")); - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } - - // Resettable prop by name - { - PropertyObject o; - QmlMetaProperty p(&o, QString("resettableProperty")); - - QCOMPARE(p.read(), QVariant(9)); - QCOMPARE(p.write(QVariant(11)), true); - QCOMPARE(p.read(), QVariant(11)); - - QCOMPARE(p.isResettable(), true); - QCOMPARE(p.reset(), true); - - QCOMPARE(p.read(), QVariant(9)); - } - - // Deleted object - { - PropertyObject *o = new PropertyObject; - - QmlMetaProperty p(o, QString("resettableProperty")); - - QCOMPARE(p.isResettable(), true); - QCOMPARE(p.reset(), true); - - delete o; - - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } - - // Signal property - { - PropertyObject o; - QmlMetaProperty p(&o, "onClicked"); - - QCOMPARE(p.isResettable(), false); - QCOMPARE(p.reset(), false); - } -} - -void tst_qmlmetaproperty::writeObjectToList() -{ - QmlComponent containerComponent(&engine); - containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); - MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); - QVERIFY(container != 0); - QmlListReference list(container, "children"); - QVERIFY(list.count() == 1); - - MyQmlObject *object = new MyQmlObject; - QmlMetaProperty prop(container, "children"); - prop.write(qVariantFromValue(object)); - QCOMPARE(list.count(), 1); - QCOMPARE(list.at(0), object); -} - -Q_DECLARE_METATYPE(QList<QObject *>); -void tst_qmlmetaproperty::writeListToList() -{ - QmlComponent containerComponent(&engine); - containerComponent.setData("import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl()); - MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create()); - QVERIFY(container != 0); - QmlListReference list(container, "children"); - QVERIFY(list.count() == 1); - - QList<QObject*> objList; - objList << new MyQmlObject() << new MyQmlObject() << new MyQmlObject() << new MyQmlObject(); - QmlMetaProperty prop(container, "children"); - prop.write(qVariantFromValue(objList)); - QCOMPARE(list.count(), 4); - - //XXX need to try this with read/write prop (for read-only it correctly doesn't write) - /*QList<MyQmlObject*> typedObjList; - typedObjList << new MyQmlObject(); - prop.write(qVariantFromValue(&typedObjList)); - QCOMPARE(container->children()->size(), 1);*/ -} - -void tst_qmlmetaproperty::crashOnValueProperty() -{ - QmlEngine *engine = new QmlEngine; - QmlComponent component(engine); - - component.setData("import Test 1.0\nPropertyObject { wrectProperty.x: 10 }", QUrl()); - PropertyObject *obj = qobject_cast<PropertyObject*>(component.create()); - QVERIFY(obj != 0); - - QmlMetaProperty p = QmlMetaProperty::createProperty(obj, "wrectProperty.x", qmlContext(obj)); - QCOMPARE(p.name(), QString("wrectProperty.x")); - - QCOMPARE(p.read(), QVariant(10)); - - //don't crash once the engine is deleted - delete engine; - engine = 0; - - QCOMPARE(p.propertyTypeName(), "int"); - QCOMPARE(p.read(), QVariant(10)); - p.write(QVariant(20)); - QCOMPARE(p.read(), QVariant(20)); -} - -QTEST_MAIN(tst_qmlmetaproperty) - -#include "tst_qmlmetaproperty.moc" diff --git a/tests/auto/declarative/qmlmetatype/qmlmetatype.pro b/tests/auto/declarative/qmlmetatype/qmlmetatype.pro deleted file mode 100644 index 3a9a400..0000000 --- a/tests/auto/declarative/qmlmetatype/qmlmetatype.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlmetatype.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp b/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp deleted file mode 100644 index 750ccf8..0000000 --- a/tests/auto/declarative/qmlmetatype/tst_qmlmetatype.cpp +++ /dev/null @@ -1,371 +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 <qtest.h> -#include <QmlMetaType> -#include <QLocale> -#include <QPixmap> -#include <QBitmap> -#include <QPen> -#include <QTextLength> -#include <QMatrix4x4> -#include <QVector2D> -#include <QVector3D> -#include <QVector4D> -#include <QQuaternion> -#include <qml.h> - -class tst_qmlmetatype : public QObject -{ - Q_OBJECT -public: - tst_qmlmetatype() {} - -private slots: - void copy(); - - void qmlParserStatusCast(); - void qmlPropertyValueSourceCast(); - void qmlPropertyValueInterceptorCast(); - - void isList(); - - void defaultObject(); -}; - -class TestType : public QObject -{ - Q_OBJECT - Q_PROPERTY(int foo READ foo); - - Q_CLASSINFO("DefaultProperty", "foo"); -public: - int foo() { return 0; } -}; -QML_DECLARE_TYPE(TestType); -QML_DEFINE_TYPE(Test, 1, 0, TestType, TestType); - -class ParserStatusTestType : public QObject, public QmlParserStatus -{ - Q_OBJECT - Q_CLASSINFO("DefaultProperty", "foo"); // Missing default property -}; -QML_DECLARE_TYPE(ParserStatusTestType); -QML_DEFINE_TYPE(Test, 1, 0, ParserStatusTestType, ParserStatusTestType); - -class ValueSourceTestType : public QObject, public QmlPropertyValueSource -{ - Q_OBJECT - Q_INTERFACES(QmlPropertyValueSource) -public: - virtual void setTarget(const QmlMetaProperty &) {} -}; -QML_DECLARE_TYPE(ValueSourceTestType); -QML_DEFINE_TYPE(Test, 1, 0, ValueSourceTestType, ValueSourceTestType); - -class ValueInterceptorTestType : public QObject, public QmlPropertyValueInterceptor -{ - Q_OBJECT - Q_INTERFACES(QmlPropertyValueInterceptor) -public: - virtual void setTarget(const QmlMetaProperty &) {} - virtual void write(const QVariant &) {} -}; -QML_DECLARE_TYPE(ValueInterceptorTestType); -QML_DEFINE_TYPE(Test, 1, 0, ValueInterceptorTestType, ValueInterceptorTestType); - - -#define COPY_TEST(cpptype, metatype, value, defaultvalue) \ -{ \ - cpptype v = (value); cpptype v2 = (value); \ - QVERIFY(QmlMetaType::copy(QMetaType:: metatype, &v, 0)); \ - QVERIFY(v == (defaultvalue)); \ - QVERIFY(QmlMetaType::copy(QMetaType:: metatype, &v, &v2)); \ - QVERIFY(v == (value)); \ -} - -#define QT_COPY_TEST(type, value) \ -{ \ - type v = (value); type v2 = (value); \ - QVERIFY(QmlMetaType::copy(QMetaType:: type, &v, 0)); \ - QVERIFY(v == (type ())); \ - QVERIFY(QmlMetaType::copy(QMetaType:: type, &v, &v2)); \ - QVERIFY(v == (value)); \ -} - -void tst_qmlmetatype::copy() -{ - QVERIFY(QmlMetaType::copy(QMetaType::Void, 0, 0)); - - COPY_TEST(bool, Bool, true, false); - COPY_TEST(int, Int, 10, 0); - COPY_TEST(unsigned int, UInt, 10, 0); - COPY_TEST(long long, LongLong, 10, 0); - COPY_TEST(unsigned long long, ULongLong, 10, 0); - COPY_TEST(double, Double, 19.2, 0); - - QT_COPY_TEST(QChar, QChar('a')); - - QVariantMap variantMap; - variantMap.insert("Hello World!", QVariant(10)); - QT_COPY_TEST(QVariantMap, variantMap); - - QT_COPY_TEST(QVariantList, QVariantList() << QVariant(19.2)); - QT_COPY_TEST(QString, QString("QML Rocks!")); - QT_COPY_TEST(QStringList, QStringList() << "QML" << "Rocks"); - QT_COPY_TEST(QByteArray, QByteArray("0x1102DDD")); - QT_COPY_TEST(QBitArray, QBitArray(102, true)); - QDate cd = QDate::currentDate(); - QT_COPY_TEST(QDate, cd); - QTime ct = QTime::currentTime(); - QT_COPY_TEST(QTime, ct); - QDateTime cdt = QDateTime::currentDateTime(); - QT_COPY_TEST(QDateTime, cdt); - QT_COPY_TEST(QUrl, QUrl("http://www.nokia.com")); - QT_COPY_TEST(QLocale, QLocale(QLocale::English, QLocale::Australia)); - QT_COPY_TEST(QRect, QRect(-10, 10, 102, 99)); - QT_COPY_TEST(QRectF, QRectF(-10.2, 1.2, 102, 99.6)); - QT_COPY_TEST(QSize, QSize(100, 2)); - QT_COPY_TEST(QSizeF, QSizeF(20.2, -100234.2)); - QT_COPY_TEST(QLine, QLine(0, 0, 100, 100)); - QT_COPY_TEST(QLineF, QLineF(-10.2, 0, 103, 1)); - QT_COPY_TEST(QPoint, QPoint(-1912, 1613)); - QT_COPY_TEST(QPointF, QPointF(-908.1, 1612)); - QT_COPY_TEST(QRegExp, QRegExp("(\\d+)(?:\\s*)(cm|inch)")); - - QVariantHash variantHash; - variantHash.insert("Hello World!", QVariant(19)); - QT_COPY_TEST(QVariantHash, variantHash); - -#ifdef QT3_SUPPORT - QT_COPY_TEST(QColorGroup, QColorGroup(Qt::red, Qt::red, Qt::red, Qt::red, Qt::red, Qt::red, Qt::red)); -#endif - - QT_COPY_TEST(QFont, QFont("Helvetica", 1024)); - - { - QPixmap v = QPixmap(100, 100); QPixmap v2 = QPixmap(100, 100); - QVERIFY(QmlMetaType::copy(QMetaType::QPixmap, &v, 0)); - QVERIFY(v.size() == QPixmap().size()); - QVERIFY(QmlMetaType::copy(QMetaType::QPixmap , &v, &v2)); - QVERIFY(v.size() == QPixmap(100,100).size()); - } - - QT_COPY_TEST(QBrush, QBrush(Qt::blue)); - QT_COPY_TEST(QColor, QColor("lightsteelblue")); - QT_COPY_TEST(QPalette, QPalette(Qt::green)); - - { - QPixmap icon(100, 100); - - QIcon v = QIcon(icon); QIcon v2 = QIcon(icon); - QVERIFY(QmlMetaType::copy(QMetaType::QIcon, &v, 0)); - QVERIFY(v.isNull() == QIcon().isNull()); - QVERIFY(QmlMetaType::copy(QMetaType::QIcon , &v, &v2)); - QVERIFY(v.isNull() == QIcon(icon).isNull()); - } - - { - QImage v = QImage(100, 100, QImage::Format_RGB32); - QImage v2 = QImage(100, 100, QImage::Format_RGB32); - QVERIFY(QmlMetaType::copy(QMetaType::QImage, &v, 0)); - QVERIFY(v.size() == QImage().size()); - QVERIFY(QmlMetaType::copy(QMetaType::QImage , &v, &v2)); - QVERIFY(v.size() == QImage(100,100, QImage::Format_RGB32).size()); - } - - QT_COPY_TEST(QPolygon, QPolygon(QRect(100, 100, 200, 103))); - QT_COPY_TEST(QRegion, QRegion(QRect(0, 10, 99, 87))); - - { - QBitmap v = QBitmap(100, 100); QBitmap v2 = QBitmap(100, 100); - QVERIFY(QmlMetaType::copy(QMetaType::QBitmap, &v, 0)); - QVERIFY(v.size() == QBitmap().size()); - QVERIFY(QmlMetaType::copy(QMetaType::QBitmap , &v, &v2)); - QVERIFY(v.size() == QBitmap(100,100).size()); - } - - { - QCursor v = QCursor(Qt::SizeFDiagCursor); QCursor v2 = QCursor(Qt::SizeFDiagCursor); - QVERIFY(QmlMetaType::copy(QMetaType::QCursor, &v, 0)); - QVERIFY(v.shape() == QCursor().shape()); - QVERIFY(QmlMetaType::copy(QMetaType::QCursor , &v, &v2)); - QVERIFY(v.shape() == QCursor(Qt::SizeFDiagCursor).shape()); - } - - QT_COPY_TEST(QSizePolicy, QSizePolicy(QSizePolicy::Fixed, QSizePolicy::Maximum)); - QT_COPY_TEST(QKeySequence, QKeySequence("Ctrl+O")); - QT_COPY_TEST(QPen, QPen(Qt::red)); - QT_COPY_TEST(QTextLength, QTextLength(QTextLength::FixedLength, 10.2)); - QT_COPY_TEST(QTextFormat, QTextFormat(QTextFormat::ListFormat)); - QT_COPY_TEST(QMatrix, QMatrix().translate(10, 10)); - QT_COPY_TEST(QTransform, QTransform().translate(10, 10)); - QT_COPY_TEST(QMatrix4x4, QMatrix4x4(1,0,2,3,0,1,0,0,9,0,1,0,0,0,10,1)); - QT_COPY_TEST(QVector2D, QVector2D(10.2, 1)); - QT_COPY_TEST(QVector3D, QVector3D(10.2, 1, -2)); - QT_COPY_TEST(QVector4D, QVector4D(10.2, 1, -2, 1.2)); - QT_COPY_TEST(QQuaternion, QQuaternion(1.0, 10.2, 1, -2)); - - int voidValue; - COPY_TEST(void *, VoidStar, (void *)&voidValue, (void *)0); - COPY_TEST(long, Long, 10, 0); - COPY_TEST(short, Short, 10, 0); - COPY_TEST(char, Char, 'a', 0); - COPY_TEST(unsigned long, ULong, 10, 0); - COPY_TEST(unsigned short, UShort, 10, 0); - COPY_TEST(unsigned char, UChar, 'a', 0); - COPY_TEST(float, Float, 10.5, 0); - - QObject objectValue; - QWidget widgetValue; - COPY_TEST(QObject *, QObjectStar, &objectValue, 0); - COPY_TEST(QWidget *, QWidgetStar, &widgetValue, 0); - COPY_TEST(qreal, QReal, 10.2, 0); - - { - QVariant tv = QVariant::fromValue(QVariant(10)); - QVariant v(tv); QVariant v2(tv); - QVERIFY(QmlMetaType::copy(qMetaTypeId<QVariant>(), &v, 0)); - QVERIFY(v == QVariant()); - QVERIFY(QmlMetaType::copy(qMetaTypeId<QVariant>(), &v, &v2)); - QVERIFY(v == tv); - } - - { - TestType t; QVariant tv = QVariant::fromValue(&t); - - QVariant v(tv); QVariant v2(tv); - QVERIFY(QmlMetaType::copy(qMetaTypeId<TestType *>(), &v, 0)); - QVERIFY(v == QVariant::fromValue((TestType *)0)); - QVERIFY(QmlMetaType::copy(qMetaTypeId<TestType *>(), &v, &v2)); - QVERIFY(v == tv); - } -} - -void tst_qmlmetatype::qmlParserStatusCast() -{ - QVERIFY(QmlMetaType::qmlType(QVariant::Int) == 0); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<TestType *>())->parserStatusCast(), -1); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->parserStatusCast(), -1); - - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - int cast = QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->parserStatusCast(); - QVERIFY(cast != -1); - QVERIFY(cast != 0); - - ParserStatusTestType t; - QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlParserStatus *)&t)); - - QmlParserStatus *status = reinterpret_cast<QmlParserStatus *>(reinterpret_cast<char *>((QObject *)&t) + cast); - QCOMPARE(status, &t); -} - -void tst_qmlmetatype::qmlPropertyValueSourceCast() -{ - QVERIFY(QmlMetaType::qmlType(QVariant::Int) == 0); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueSourceCast(), -1); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueSourceCast(), -1); - - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>()) != 0); - int cast = QmlMetaType::qmlType(qMetaTypeId<ValueSourceTestType *>())->propertyValueSourceCast(); - QVERIFY(cast != -1); - QVERIFY(cast != 0); - - ValueSourceTestType t; - QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlPropertyValueSource *)&t)); - - QmlPropertyValueSource *source = reinterpret_cast<QmlPropertyValueSource *>(reinterpret_cast<char *>((QObject *)&t) + cast); - QCOMPARE(source, &t); -} - -void tst_qmlmetatype::qmlPropertyValueInterceptorCast() -{ - QVERIFY(QmlMetaType::qmlType(QVariant::Int) == 0); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<TestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<TestType *>())->propertyValueInterceptorCast(), -1); - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>()) != 0); - QCOMPARE(QmlMetaType::qmlType(qMetaTypeId<ParserStatusTestType *>())->propertyValueInterceptorCast(), -1); - - QVERIFY(QmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>()) != 0); - int cast = QmlMetaType::qmlType(qMetaTypeId<ValueInterceptorTestType *>())->propertyValueInterceptorCast(); - QVERIFY(cast != -1); - QVERIFY(cast != 0); - - ValueInterceptorTestType t; - QVERIFY(reinterpret_cast<char *>((QObject *)&t) != reinterpret_cast<char *>((QmlPropertyValueInterceptor *)&t)); - - QmlPropertyValueInterceptor *interceptor = reinterpret_cast<QmlPropertyValueInterceptor *>(reinterpret_cast<char *>((QObject *)&t) + cast); - QCOMPARE(interceptor, &t); -} - -void tst_qmlmetatype::isList() -{ - QCOMPARE(QmlMetaType::isList(QVariant::Invalid), false); - QCOMPARE(QmlMetaType::isList(QVariant::Int), false); - - QmlListProperty<TestType> list; - - QCOMPARE(QmlMetaType::isList(qMetaTypeId<QmlListProperty<TestType> >()), true); -} - -void tst_qmlmetatype::defaultObject() -{ - QVERIFY(QmlMetaType::defaultProperty(&QObject::staticMetaObject).name() == 0); - QVERIFY(QmlMetaType::defaultProperty(&ParserStatusTestType::staticMetaObject).name() == 0); - QCOMPARE(QString(QmlMetaType::defaultProperty(&TestType::staticMetaObject).name()), QString("foo")); - - QObject o; - TestType t; - ParserStatusTestType p; - - QVERIFY(QmlMetaType::defaultProperty((QObject *)0).name() == 0); - QVERIFY(QmlMetaType::defaultProperty(&o).name() == 0); - QVERIFY(QmlMetaType::defaultProperty(&p).name() == 0); - QCOMPARE(QString(QmlMetaType::defaultProperty(&t).name()), QString("foo")); -} - -QTEST_MAIN(tst_qmlmetatype) - -#include "tst_qmlmetatype.moc" diff --git a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp deleted file mode 100644 index 0d7f985..0000000 --- a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.cpp +++ /dev/null @@ -1,84 +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 <QtDeclarative/qmlmoduleplugin.h> -#include <QtDeclarative/qml.h> -#include <QDebug> - -class MyPluginType : public QObject -{ - Q_OBJECT - Q_PROPERTY(int value READ value WRITE setValue) - -public: - MyPluginType(QObject *parent=0) : QObject(parent) - { - qWarning("import worked"); - } - - int value() const { return v; } - void setValue(int i) { v = i; } - -private: - int v; -}; - -QML_DECLARE_TYPE(MyPluginType); -QML_DEFINE_TYPE(com.nokia.AutoTestQmlPluginType,1,0,MyPluginType,MyPluginType); - - -class MyPlugin : public QmlModulePlugin -{ - Q_OBJECT -public: - MyPlugin() - { - qWarning("plugin created"); - } - - QStringList keys() const - { - return QStringList() << QLatin1String("com.nokia.AutoTestQmlPluginType"); - } -}; - -#include "plugin.moc" - -Q_EXPORT_PLUGIN2(plugin, MyPlugin); diff --git a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.pro b/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.pro deleted file mode 100644 index 0625ea3..0000000 --- a/tests/auto/declarative/qmlmoduleplugin/plugin/plugin.pro +++ /dev/null @@ -1,5 +0,0 @@ -TEMPLATE = lib -CONFIG += plugin -SOURCES = plugin.cpp -QT = core declarative -DESTDIR = qmlmodules diff --git a/tests/auto/declarative/qmlmoduleplugin/qmlmoduleplugin.pro b/tests/auto/declarative/qmlmoduleplugin/qmlmoduleplugin.pro deleted file mode 100644 index c60743d..0000000 --- a/tests/auto/declarative/qmlmoduleplugin/qmlmoduleplugin.pro +++ /dev/null @@ -1,7 +0,0 @@ -QT = core -TEMPLATE = subdirs -SUBDIRS = plugin -tst_qmlmoduleplugin_pro.depends += plugin -SUBDIRS += tst_qmlmoduleplugin.pro - - diff --git a/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.cpp b/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.cpp deleted file mode 100644 index 87125fc..0000000 --- a/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.cpp +++ /dev/null @@ -1,117 +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 <qtest.h> -#include <qdir.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <QDebug> - -class tst_qmlmoduleplugin : public QObject -{ - Q_OBJECT -public: - tst_qmlmoduleplugin() { - QCoreApplication::addLibraryPath(QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin")); -qDebug() << QLatin1String(SRCDIR) + QDir::separator() + QLatin1String("plugin"); - } - -private slots: - void importsPlugin(); -}; - -#define VERIFY_ERRORS(errorfile) \ - if (!errorfile) { \ - if (qgetenv("DEBUG") != "" && !component.errors().isEmpty()) \ - qWarning() << "Unexpected Errors:" << component.errors(); \ - QVERIFY(!component.isError()); \ - QVERIFY(component.errors().isEmpty()); \ - } else { \ - QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ - QVERIFY(file.open(QIODevice::ReadOnly)); \ - QByteArray data = file.readAll(); \ - file.close(); \ - QList<QByteArray> expected = data.split('\n'); \ - expected.removeAll(QByteArray("")); \ - QList<QmlError> errors = component.errors(); \ - QList<QByteArray> actual; \ - for (int ii = 0; ii < errors.count(); ++ii) { \ - const QmlError &error = errors.at(ii); \ - QByteArray errorStr = QByteArray::number(error.line()) + ":" + \ - QByteArray::number(error.column()) + ":" + \ - error.description().toUtf8(); \ - actual << errorStr; \ - } \ - if (qgetenv("DEBUG") != "" && expected != actual) \ - qWarning() << "Expected:" << expected << "Actual:" << actual; \ - if (qgetenv("QMLLANGUAGE_UPDATEERRORS") != "" && expected != actual) {\ - QFile file(QLatin1String("data/") + QLatin1String(errorfile)); \ - QVERIFY(file.open(QIODevice::WriteOnly)); \ - for (int ii = 0; ii < actual.count(); ++ii) { \ - file.write(actual.at(ii)); file.write("\n"); \ - } \ - file.close(); \ - } else { \ - QCOMPARE(expected, actual); \ - } \ - } - -inline QUrl TEST_FILE(const QString &filename) -{ - QFileInfo fileInfo(__FILE__); - return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename)); -} - - -void tst_qmlmoduleplugin::importsPlugin() -{ - QmlEngine engine; - QTest::ignoreMessage(QtWarningMsg, "plugin created"); - QTest::ignoreMessage(QtWarningMsg, "import worked"); - QmlComponent component(&engine, TEST_FILE("plugin.qml")); - VERIFY_ERRORS(0); - QObject *object = component.create(); - QVERIFY(object != 0); - QCOMPARE(object->property("value").toInt(),123); -} - -QTEST_MAIN(tst_qmlmoduleplugin) - -#include "tst_qmlmoduleplugin.moc" diff --git a/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.pro b/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.pro deleted file mode 100644 index 3c8a568..0000000 --- a/tests/auto/declarative/qmlmoduleplugin/tst_qmlmoduleplugin.pro +++ /dev/null @@ -1,4 +0,0 @@ -load(qttest_p4) -SOURCES = tst_qmlmoduleplugin.cpp -QT += declarative -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlnumberformatter/qmlnumberformatter.pro b/tests/auto/declarative/qmlnumberformatter/qmlnumberformatter.pro deleted file mode 100644 index 8113278..0000000 --- a/tests/auto/declarative/qmlnumberformatter/qmlnumberformatter.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlnumberformatter.cpp diff --git a/tests/auto/declarative/qmlnumberformatter/tst_qmlnumberformatter.cpp b/tests/auto/declarative/qmlnumberformatter/tst_qmlnumberformatter.cpp deleted file mode 100644 index 30f2fea..0000000 --- a/tests/auto/declarative/qmlnumberformatter/tst_qmlnumberformatter.cpp +++ /dev/null @@ -1,222 +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 <qtest.h> -#include <QDebug> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qnumberformat_p.h> -#include <private/qmlnumberformatter_p.h> - -class tst_qmlnumberformatter : public QObject -{ - Q_OBJECT -public: - tst_qmlnumberformatter(); - - void init() {} - void initTestCase() {} - - void cleanup() {} - void cleanupTestCase() {} - -private slots: - void text_data(); - void text(); - -private: - QStringList strings; - QStringList formats; - QStringList texts; -}; - -tst_qmlnumberformatter::tst_qmlnumberformatter() -{ - strings << "100.0" - << "12345" - << "1234567" - << "0.123" - << "0.9999" - << "0.989" - << "1" - << "1.0" - << "1.01"; - - formats << "" - << "0000" - << "0000.00" - << "##" - << "##.##" - << "#0.00#" - << "##,##0.##" - << "(000) 000 - 000" - << "00000,000.0000"; - - //US locale only. - texts << "100.000000" - << "12345.000000" - << "1234567.000000" - << "0.123000" - << "0.999900" - << "0.989000" - << "1.000000" - << "1.000000" - << "1.010000" //end "" - << "0100" - << "12345" - << "1234567" - << "0000" - << "0001" - << "0001" - << "0001" - << "0001" - << "0001" // end "0000" - << "0100.00" - << "12345.00" - << "1234567.00" - << "0000.12" - << "0001.00" - << "0000.99" - << "0001.00" - << "0001.00" - << "0001.01" // end "0000.00" - << "100" - << "12345" - << "1234567" - << "0" - << "1" - << "1" - << "1" - << "1" - << "1" // end "##" - << "100"//start "##.##" - << "12345" - << "1234567" - << "0.12" - << "1" - << "0.99" - << "1" - << "1" - << "1.01" // end "##.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug - << "100.00" //start "#0.00#" - << "12345.00" - << "1234567.00" - << "0.123" - << "1.00" - << "0.989" - << "1.00" - << "1.00" - << "1.01" //end "#0.00#" - << "100" //start "##,##0.##" - << "12,345" - << "1,234,567" - << "0.12" - << "1" - << "0.99" - << "1" - << "1" - << "1.01" //end "##,##0.##" -- ### EXPECT FAIL ### QNumberFormat::formatDecimal() bug - << "(000) 000 - 100" //start "(000) 000 - 000" - << "(000) 012 - 345" - << "(001) 234 - 567" - << "(000) 000 - 000" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" - << "(000) 000 - 001" // end "(000) 000 - 000" - << "00,000,100.0000" // start "00000,000.0000" - << "00,012,345.0000" - << "01,234,567.0000" - << "00,000,000.1230" - << "00,000,000.9999" - << "00,000,000.9890" - << "00,000,001.0000" - << "00,000,001.0000" - << "00,000,001.0100"; // end - - qDebug() << "strings.size()" << strings.size() - << "\nformats.size()" << formats.size() - << "texts.size()" << texts.size(); -} - -void tst_qmlnumberformatter::text_data() -{ - QTest::addColumn<QString>("string"); - QTest::addColumn<QString>("format"); - QTest::addColumn<QString>("text"); - - for (int j=0; j < formats.size(); j++) - { - for (int i=0; i < strings.size(); i++) - { - QTest::newRow(QString("%1, %2").arg(strings.at(i)).arg(formats.at(j)).toAscii()) - << strings.at(i) << formats.at(j) << texts.at(j*formats.size()+i); - } - } - -} - -void tst_qmlnumberformatter::text() -{ - QFETCH(QString, string); - QFETCH(QString, format); - QFETCH(QString, text); - - QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: ") + string + QString("; format: \"") + format + QString("\" }"); - - QmlEngine engine; - QmlComponent formatterComponent(&engine); - formatterComponent.setData(componentStr.toUtf8(), QUrl::fromLocalFile("")); - if(formatterComponent.isError()) - qDebug() << formatterComponent.errors(); - QVERIFY(formatterComponent.isReady()); - QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create()); - QVERIFY(formatter != 0); - - QCOMPARE(formatter->format(), format); - QCOMPARE(formatter->text(), text); - - delete formatter; -} - -QTEST_MAIN(tst_qmlnumberformatter) - -#include "tst_qmlnumberformatter.moc" diff --git a/tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro b/tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro deleted file mode 100644 index 423fa2f..0000000 --- a/tests/auto/declarative/qmlpixmapcache/qmlpixmapcache.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -QT += network -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlpixmapcache.cpp - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov diff --git a/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp b/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp deleted file mode 100644 index 019fc2a..0000000 --- a/tests/auto/declarative/qmlpixmapcache/tst_qmlpixmapcache.cpp +++ /dev/null @@ -1,282 +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 <qtest.h> -#include <QtTest/QtTest> -#include <private/qmlpixmapcache_p.h> -#include <QtDeclarative/qmlengine.h> -#include <QNetworkReply> - -// These don't let normal people run tests! -//#include "../network-settings.h" - -class tst_qmlpixmapcache : public QObject -{ - Q_OBJECT -public: - tst_qmlpixmapcache() : - thisfile(QUrl::fromLocalFile(__FILE__)) - { - } - -private slots: - void single(); - void single_data(); - void parallel(); - void parallel_data(); - -private: - QmlEngine engine; - QUrl thisfile; -}; - - -static int slotters=0; - -class Slotter : public QObject -{ - Q_OBJECT -public: - Slotter() - { - gotslot = false; - slotters++; - } - bool gotslot; - -public slots: - void got() - { - gotslot = true; - --slotters; - if (slotters==0) - QTestEventLoop::instance().exitLoop(); - } -}; - -#ifndef QT_NO_LOCALFILE_OPTIMIZED_QML -static const bool localfile_optimized = true; -#else -static const bool localfile_optimized = false; -#endif - -void tst_qmlpixmapcache::single_data() -{ - // Note, since QmlPixmapCache is shared, tests affect each other! - // so use different files fore all test functions. - - QTest::addColumn<QUrl>("target"); - QTest::addColumn<bool>("incache"); - QTest::addColumn<bool>("exists"); - QTest::addColumn<bool>("neterror"); - - // File URLs are optimized - QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true << false; - QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true << false; - QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false << true; -} - -void tst_qmlpixmapcache::single() -{ - QFETCH(QUrl, target); - QFETCH(bool, incache); - QFETCH(bool, exists); - QFETCH(bool, neterror); - - if (neterror) { - QString expected = "\"Error downloading " + target.toString() + " - server replied: Not Found\" "; - QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); - } else if (!exists) { - QString expected = "Cannot open QUrl( \"" + target.toString() + "\" ) "; - QTest::ignoreMessage(QtWarningMsg, expected.toLatin1()); - } - - QPixmap pixmap; - QVERIFY(pixmap.width() <= 0); // Check Qt assumption - QmlPixmapReply::Status status = QmlPixmapCache::get(target, &pixmap); - - if (incache) { - if (exists) { - QVERIFY(status == QmlPixmapReply::Ready); - QVERIFY(pixmap.width() > 0); - } else { - QVERIFY(status == QmlPixmapReply::Error); - QVERIFY(pixmap.width() <= 0); - } - } else { - QmlPixmapReply *reply = QmlPixmapCache::request(&engine, target); - QVERIFY(reply); - QVERIFY(pixmap.width() <= 0); - - Slotter getter; - connect(reply, SIGNAL(finished()), &getter, SLOT(got())); - QTestEventLoop::instance().enterLoop(10); - QVERIFY(!QTestEventLoop::instance().timeout()); - QVERIFY(getter.gotslot); - if (exists) { - QVERIFY(QmlPixmapCache::get(target, &pixmap) == QmlPixmapReply::Ready); - QVERIFY(pixmap.width() > 0); - } else { - QVERIFY(QmlPixmapCache::get(target, &pixmap) == QmlPixmapReply::Error); - QVERIFY(pixmap.width() <= 0); - } - } - - QCOMPARE(QmlPixmapCache::pendingRequests(), 0); -} - -void tst_qmlpixmapcache::parallel_data() -{ - // Note, since QmlPixmapCache is shared, tests affect each other! - // so use different files fore all test functions. - - QTest::addColumn<QUrl>("target1"); - QTest::addColumn<QUrl>("target2"); - QTest::addColumn<int>("incache"); - QTest::addColumn<int>("cancel"); // which one to cancel - QTest::addColumn<int>("requests"); - - QTest::newRow("local") - << thisfile.resolved(QUrl("data/exists1.png")) - << thisfile.resolved(QUrl("data/exists2.png")) - << (localfile_optimized ? 2 : 0) - << -1 - << (localfile_optimized ? 0 : 2) - ; - - QTest::newRow("remote") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") - << 0 - << -1 - << 2 - ; - - QTest::newRow("remoteagain") - << QUrl("http://qt.nokia.com/images/template/checkbox-on.png") - << QUrl("http://qt.nokia.com/images/products/qt-logo/image_tile") - << 2 - << -1 - << 0 - ; - - QTest::newRow("remotecopy") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") - << QUrl("http://qt.nokia.com/images/template/checkbox-off.png") - << 0 - << -1 - << 1 - ; - - QTest::newRow("remotecopycancel") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") - << QUrl("http://qt.nokia.com/rounded_block_bg.png") - << 0 - << 0 - << 1 - ; -} - -void tst_qmlpixmapcache::parallel() -{ - QFETCH(QUrl, target1); - QFETCH(QUrl, target2); - QFETCH(int, incache); - QFETCH(int, cancel); - QFETCH(int, requests); - - QList<QUrl> targets; - targets << target1 << target2; - - QList<QmlPixmapReply*> replies; - QList<Slotter*> getters; - for (int i=0; i<targets.count(); ++i) { - QUrl target = targets.at(i); - QPixmap pixmap; - QmlPixmapReply::Status status = QmlPixmapCache::get(target, &pixmap); - QmlPixmapReply *reply = 0; - if (status != QmlPixmapReply::Error && status != QmlPixmapReply::Ready) - reply = QmlPixmapCache::request(&engine, target); - replies.append(reply); - if (!reply) { - QVERIFY(pixmap.width() > 0); - getters.append(0); - } else { - QVERIFY(pixmap.width() <= 0); - getters.append(new Slotter); - connect(reply, SIGNAL(finished()), getters[i], SLOT(got())); - } - } - - QCOMPARE(incache+slotters, targets.count()); - QCOMPARE(QmlPixmapCache::pendingRequests(), requests); - - if (cancel >= 0) { - QmlPixmapCache::cancel(targets.at(cancel), getters[cancel]); - slotters--; - } - - if (slotters) { - QTestEventLoop::instance().enterLoop(10); - QVERIFY(!QTestEventLoop::instance().timeout()); - } - - for (int i=0; i<targets.count(); ++i) { - QmlPixmapReply *reply = replies[i]; - if (reply) { - if (i == cancel) { - QVERIFY(!getters[i]->gotslot); - } else { - QVERIFY(getters[i]->gotslot); - QPixmap pixmap; - QVERIFY(QmlPixmapCache::get(targets[i], &pixmap) == QmlPixmapReply::Ready); - QVERIFY(pixmap.width() > 0); - } - delete getters[i]; - } - } - - QCOMPARE(QmlPixmapCache::pendingRequests(), 0); -} - -QTEST_MAIN(tst_qmlpixmapcache) - -#include "tst_qmlpixmapcache.moc" diff --git a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro b/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro deleted file mode 100644 index 967ab76..0000000 --- a/tests/auto/declarative/qmlpropertymap/qmlpropertymap.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlpropertymap.cpp diff --git a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp b/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp deleted file mode 100644 index 26b89a6..0000000 --- a/tests/auto/declarative/qmlpropertymap/tst_qmlpropertymap.cpp +++ /dev/null @@ -1,171 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcontext.h> -#include <QtDeclarative/qmlpropertymap.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicstext_p.h> -#include <QSignalSpy> - -class tst_QmlPropertyMap : public QObject -{ - Q_OBJECT -public: - tst_QmlPropertyMap() {} - -private slots: - void insert(); - void operatorInsert(); - void operatorValue(); - void clear(); - void changed(); - void count(); -}; - -void tst_QmlPropertyMap::insert() -{ - QmlPropertyMap map; - map.insert(QLatin1String("key1"),100); - map.insert(QLatin1String("key2"),200); - QVERIFY(map.keys().count() == 2); - QVERIFY(map.contains(QLatin1String("key1"))); - - QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); - QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); - - map.insert(QLatin1String("key1"),"Hello World"); - QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); -} - -void tst_QmlPropertyMap::operatorInsert() -{ - QmlPropertyMap map; - map[QLatin1String("key1")] = 100; - map[QLatin1String("key2")] = 200; - QVERIFY(map.keys().count() == 2); - - QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); - QCOMPARE(map.value(QLatin1String("key2")), QVariant(200)); - - map[QLatin1String("key1")] = "Hello World"; - QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); -} - -void tst_QmlPropertyMap::operatorValue() -{ - QmlPropertyMap map; - map.insert(QLatin1String("key1"),100); - map.insert(QLatin1String("key2"),200); - QVERIFY(map.count() == 2); - QVERIFY(map.contains(QLatin1String("key1"))); - - const QmlPropertyMap &constMap = map; - - QCOMPARE(constMap.value(QLatin1String("key1")), QVariant(100)); - QCOMPARE(constMap.value(QLatin1String("key2")), QVariant(200)); - QCOMPARE(constMap[QLatin1String("key1")], constMap.value(QLatin1String("key1"))); - QCOMPARE(constMap[QLatin1String("key2")], constMap.value(QLatin1String("key2"))); -} - -void tst_QmlPropertyMap::clear() -{ - QmlPropertyMap map; - map.insert(QLatin1String("key1"),100); - QVERIFY(map.keys().count() == 1); - - QCOMPARE(map.value(QLatin1String("key1")), QVariant(100)); - - map.clear(QLatin1String("key1")); - QVERIFY(map.keys().count() == 1); - QVERIFY(map.contains(QLatin1String("key1"))); - QCOMPARE(map.value(QLatin1String("key1")), QVariant()); -} - -void tst_QmlPropertyMap::changed() -{ - QmlPropertyMap map; - QSignalSpy spy(&map, SIGNAL(valueChanged(const QString&))); - map.insert(QLatin1String("key1"),100); - map.insert(QLatin1String("key2"),200); - QCOMPARE(spy.count(), 0); - - map.clear(QLatin1String("key1")); - QCOMPARE(spy.count(), 0); - - //make changes in QML - QmlEngine engine; - QmlContext *ctxt = engine.rootContext(); - ctxt->setContextProperty(QLatin1String("testdata"), &map); - QmlComponent component(&engine); - component.setData("import Qt 4.6\nText { text: { testdata.key1 = 'Hello World'; 'X' } }", - QUrl::fromLocalFile("")); - QVERIFY(component.isReady()); - QmlGraphicsText *txt = qobject_cast<QmlGraphicsText*>(component.create()); - QVERIFY(txt); - QCOMPARE(txt->text(), QString('X')); - QCOMPARE(spy.count(), 1); - QList<QVariant> arguments = spy.takeFirst(); - QCOMPARE(arguments.at(0).toString(),QLatin1String("key1")); - QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World")); -} - -void tst_QmlPropertyMap::count() -{ - QmlPropertyMap map; - QCOMPARE(map.isEmpty(), true); - map.insert(QLatin1String("key1"),100); - map.insert(QLatin1String("key2"),200); - QCOMPARE(map.count(), 2); - QCOMPARE(map.isEmpty(), false); - - map.insert(QLatin1String("key3"),"Hello World"); - QCOMPARE(map.count(), 3); - - //clearing doesn't remove the key - map.clear(QLatin1String("key3")); - QCOMPARE(map.count(), 3); - QCOMPARE(map.size(), map.count()); -} - -QTEST_MAIN(tst_QmlPropertyMap) - -#include "tst_qmlpropertymap.moc" diff --git a/tests/auto/declarative/qmlqt/qmlqt.pro b/tests/auto/declarative/qmlqt/qmlqt.pro deleted file mode 100644 index 5e79ea6..0000000 --- a/tests/auto/declarative/qmlqt/qmlqt.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -SOURCES += tst_qmlqt.cpp -macx:CONFIG -= app_bundle - -DEFINES += SRCDIR=\\\"$$PWD\\\" - -# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -# LIBS += -lgcov diff --git a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp b/tests/auto/declarative/qmlqt/tst_qmlqt.cpp deleted file mode 100644 index c3c2521..0000000 --- a/tests/auto/declarative/qmlqt/tst_qmlqt.cpp +++ /dev/null @@ -1,369 +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 <qtest.h> -#include <QDebug> -#include <QmlEngine> -#include <QFileInfo> -#include <QmlComponent> -#include <QDir> -#include <QVector3D> -#include <QCryptographicHash> -#include <QmlGraphicsItem> - -class tst_qmlqt : public QObject -{ - Q_OBJECT -public: - tst_qmlqt() {} - -private slots: - void enums(); - void rgba(); - void hsla(); - void rect(); - void point(); - void size(); - void vector(); - void lighter(); - void darker(); - void tint(); - void closestAngle(); - void playSound(); - void openUrlExternally(); - void md5(); - void createComponent(); - void createQmlObject(); - void consoleLog(); - -private: - QmlEngine engine; -}; - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -void tst_qmlqt::enums() -{ - QmlComponent component(&engine, TEST_FILE("enums.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toInt(), (int)Qt::Key_Escape); - QCOMPARE(object->property("test2").toInt(), (int)Qt::DescendingOrder); - QCOMPARE(object->property("test3").toInt(), (int)Qt::ElideMiddle); - QCOMPARE(object->property("test4").toInt(), (int)Qt::AlignRight); - - delete object; -} - -void tst_qmlqt::rgba() -{ - QmlComponent component(&engine, TEST_FILE("rgba.qml")); - - QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; - QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0, 0, 0.8)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0.5, 0.3, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::hsla() -{ - QmlComponent component(&engine, TEST_FILE("hsla.qml")); - - QString warning1 = component.url().toString() + ":6: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning3 = component.url().toString() + ":8: Unable to assign null to QColor"; - QString warning4 = component.url().toString() + ":9: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromHslF(1, 0, 0, 0.8)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromHslF(1, 0.5, 0.3, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::rect() -{ - QmlComponent component(&engine, TEST_FILE("rect.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QRectF>(object->property("test1")), QRectF(10, 13, 100, 109)); - QCOMPARE(qvariant_cast<QRectF>(object->property("test2")), QRectF(-10, 13, 100, 109.6)); - QCOMPARE(qvariant_cast<QRectF>(object->property("test3")), QRectF()); - QCOMPARE(qvariant_cast<QRectF>(object->property("test4")), QRectF()); - QCOMPARE(qvariant_cast<QRectF>(object->property("test5")), QRectF()); - - delete object; -} - -void tst_qmlqt::point() -{ - QmlComponent component(&engine, TEST_FILE("point.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QPointF>(object->property("test1")), QPointF(19, 34)); - QCOMPARE(qvariant_cast<QPointF>(object->property("test2")), QPointF(-3, 109.2)); - QCOMPARE(qvariant_cast<QPointF>(object->property("test3")), QPointF()); - QCOMPARE(qvariant_cast<QPointF>(object->property("test4")), QPointF()); - - delete object; -} - -void tst_qmlqt::size() -{ - QmlComponent component(&engine, TEST_FILE("size.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QSizeF>(object->property("test1")), QSizeF(19, 34)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test2")), QSizeF(3, 109.2)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test3")), QSizeF(-3, 10)); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test4")), QSizeF()); - QCOMPARE(qvariant_cast<QSizeF>(object->property("test5")), QSizeF()); - - delete object; -} - -void tst_qmlqt::vector() -{ - QmlComponent component(&engine, TEST_FILE("vector.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QVector3D>(object->property("test1")), QVector3D(1, 0, 0.9)); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test2")), QVector3D(102, -10, -982.1)); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test3")), QVector3D()); - QCOMPARE(qvariant_cast<QVector3D>(object->property("test4")), QVector3D()); - - delete object; -} - -void tst_qmlqt::lighter() -{ - QmlComponent component(&engine, TEST_FILE("lighter.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).lighter()); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").lighter()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::darker() -{ - QmlComponent component(&engine, TEST_FILE("darker.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(1, 0.8, 0.3).darker()); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor("red").darker()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test6")), QColor()); - - delete object; -} - -void tst_qmlqt::tint() -{ - QmlComponent component(&engine, TEST_FILE("tint.qml")); - - QString warning1 = component.url().toString() + ":7: Unable to assign null to QColor"; - QString warning2 = component.url().toString() + ":8: Unable to assign null to QColor"; - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<QColor>(object->property("test1")), QColor::fromRgbF(0, 0, 1)); - QCOMPARE(qvariant_cast<QColor>(object->property("test2")), QColor::fromRgbF(1, 0, 0)); - QEXPECT_FAIL("", "QT-2424",Continue); - QCOMPARE(qvariant_cast<QColor>(object->property("test3")), QColor::fromRgbF(1, 0, 0)); - QCOMPARE(qvariant_cast<QColor>(object->property("test4")), QColor()); - QCOMPARE(qvariant_cast<QColor>(object->property("test5")), QColor()); - - delete object; -} - -void tst_qmlqt::closestAngle() -{ - QmlComponent component(&engine, TEST_FILE("closestangle.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(qvariant_cast<qreal>(object->property("testSame")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testLess")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testMore")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("testFail")), 0.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test5")), 1.0); - QCOMPARE(qvariant_cast<qreal>(object->property("test6")), 1.11); - QCOMPARE(qvariant_cast<qreal>(object->property("test7")), 1.11); - - delete object; -} - -void tst_qmlqt::playSound() -{ - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); -} - -void tst_qmlqt::openUrlExternally() -{ - QEXPECT_FAIL("", "How do we test this?", Abort); - QVERIFY(false); -} - -void tst_qmlqt::md5() -{ - QmlComponent component(&engine, TEST_FILE("md5.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test1").toString(), QLatin1String(QCryptographicHash::hash(QByteArray(), QCryptographicHash::Md5).toHex())); - QCOMPARE(object->property("test2").toString(), QLatin1String(QCryptographicHash::hash("Hello World", QCryptographicHash::Md5).toHex())); - - delete object; -} - -void tst_qmlqt::createComponent() -{ - QmlComponent component(&engine, TEST_FILE("createComponent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("incorrectArgCount1").toBool(), true); - QCOMPARE(object->property("incorrectArgCount2").toBool(), true); - QCOMPARE(object->property("emptyArg").toBool(), true); - - QCOMPARE(object->property("absoluteUrl").toString(), QString("http://www.example.com/test.qml")); - QCOMPARE(object->property("relativeUrl").toString(), TEST_FILE("createComponentData.qml").toString()); - - delete object; -} - -void tst_qmlqt::createQmlObject() -{ - QmlComponent component(&engine, TEST_FILE("createQmlObject.qml")); - - QString warning1 = "QmlEngine::createQmlObject():"; - QString warning2 = " " + TEST_FILE("main.qml").toString() + ":4:1: Duplicate property name"; - QString warning3 = "QmlEngine::createQmlObject(): Component is not ready"; - QString warning4 = "QmlEngine::createQmlObject():"; - QString warning5 = " " + TEST_FILE("inline").toString() + ":3: Cannot assign object type QObject with no default method"; - - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning1)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning2)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning3)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning4)); - QTest::ignoreMessage(QtWarningMsg, qPrintable(warning5)); - - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("incorrectArgCount1").toBool(), true); - QCOMPARE(object->property("incorrectArgCount2").toBool(), true); - QCOMPARE(object->property("emptyArg").toBool(), true); - QCOMPARE(object->property("errors").toBool(), true); - QCOMPARE(object->property("noParent").toBool(), true); - QCOMPARE(object->property("notReady").toBool(), true); - QCOMPARE(object->property("runtimeError").toBool(), true); - QCOMPARE(object->property("success").toBool(), true); - - QmlGraphicsItem *item = qobject_cast<QmlGraphicsItem *>(object); - QVERIFY(item != 0); - QVERIFY(item->childItems().count() == 1); - - delete object; -} - -void tst_qmlqt::consoleLog() -{ - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QTest::ignoreMessage(QtDebugMsg, "completed ok"); - QmlComponent component(&engine, TEST_FILE("consoleLog.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - delete object; -} - -QTEST_MAIN(tst_qmlqt) - -#include "tst_qmlqt.moc" diff --git a/tests/auto/declarative/qmlspringfollow/qmlspringfollow.pro b/tests/auto/declarative/qmlspringfollow/qmlspringfollow.pro deleted file mode 100644 index ffaa97f..0000000 --- a/tests/auto/declarative/qmlspringfollow/qmlspringfollow.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlspringfollow.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp b/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp deleted file mode 100644 index 393b351..0000000 --- a/tests/auto/declarative/qmlspringfollow/tst_qmlspringfollow.cpp +++ /dev/null @@ -1,137 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlspringfollow_p.h> -#include <private/qmlvaluetype_p.h> -#include "../../../shared/util.h" - -class tst_qmlspringfollow : public QObject -{ - Q_OBJECT -public: - tst_qmlspringfollow(); - -private slots: - void defaultValues(); - void values(); - void disabled(); - -private: - QmlEngine engine; -}; - -tst_qmlspringfollow::tst_qmlspringfollow() -{ -} - -void tst_qmlspringfollow::defaultValues() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow1.qml")); - QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 0.); - QCOMPARE(obj->velocity(), 0.); - QCOMPARE(obj->spring(), 0.); - QCOMPARE(obj->damping(), 0.); - QCOMPARE(obj->epsilon(), 0.01); - QCOMPARE(obj->modulus(), 0.); - QCOMPARE(obj->value(), 0.); - QCOMPARE(obj->mass(), 1.); - QCOMPARE(obj->enabled(), true); - QCOMPARE(obj->inSync(), true); - - delete obj; -} - -void tst_qmlspringfollow::values() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow2.qml")); - QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 1.44); - QCOMPARE(obj->velocity(), 0.9); - QCOMPARE(obj->spring(), 1.0); - QCOMPARE(obj->damping(), 0.5); - QCOMPARE(obj->epsilon(), 0.25); - QCOMPARE(obj->modulus(), 360.0); - QCOMPARE(obj->mass(), 2.0); - QCOMPARE(obj->enabled(), true); - - QTRY_COMPARE(obj->value(), 1.44); - QTRY_COMPARE(obj->inSync(), true); - - delete obj; -} - -void tst_qmlspringfollow::disabled() -{ - QmlEngine engine; - QmlComponent c(&engine, QUrl::fromLocalFile(SRCDIR "/data/springfollow3.qml")); - QmlSpringFollow *obj = qobject_cast<QmlSpringFollow*>(c.create()); - - QVERIFY(obj != 0); - - QCOMPARE(obj->sourceValue(), 1.44); - QCOMPARE(obj->velocity(), 0.9); - QCOMPARE(obj->spring(), 1.0); - QCOMPARE(obj->damping(), 0.5); - QCOMPARE(obj->epsilon(), 0.25); - QCOMPARE(obj->modulus(), 360.0); - QCOMPARE(obj->mass(), 2.0); - QCOMPARE(obj->enabled(), false); - - QCOMPARE(obj->value(), 0.0); - QCOMPARE(obj->inSync(), false); - - delete obj; -} - -QTEST_MAIN(tst_qmlspringfollow) - -#include "tst_qmlspringfollow.moc" diff --git a/tests/auto/declarative/qmlstates/qmlstates.pro b/tests/auto/declarative/qmlstates/qmlstates.pro deleted file mode 100644 index 538734a..0000000 --- a/tests/auto/declarative/qmlstates/qmlstates.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlstates.cpp - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp b/tests/auto/declarative/qmlstates/tst_qmlstates.cpp deleted file mode 100644 index b910c85..0000000 --- a/tests/auto/declarative/qmlstates/tst_qmlstates.cpp +++ /dev/null @@ -1,911 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicsanchors_p_p.h> -#include <private/qmlgraphicsrectangle_p.h> -#include <private/qmlpropertychanges_p.h> -#include <private/qmlstategroup_p.h> - -class tst_qmlstates : public QObject -{ - Q_OBJECT -public: - tst_qmlstates() {} - -private: - static QByteArray fullDataPath(const QString &path); - -private slots: - void basicChanges(); - void basicExtension(); - void basicBinding(); - void signalOverride(); - void signalOverrideCrash(); - void parentChange(); - void parentChangeErrors(); - void anchorChanges(); - void anchorChanges2(); - void anchorChanges3(); - void anchorChanges4(); - void anchorChanges5(); - void script(); - void restoreEntryValues(); - void explicitChanges(); - void propertyErrors(); - void incorrectRestoreBug(); - void autoStateAtStartupRestoreBug(); - void deletingChange(); - void deletingState(); - void tempState(); - void illegalTempState(); - void nonExistantProperty(); -}; - -QByteArray tst_qmlstates::fullDataPath(const QString &path) -{ - return QUrl::fromLocalFile(SRCDIR + path).toString().toUtf8(); -} - -void tst_qmlstates::basicChanges() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges2.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges3.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),1); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),1); - - rect->setState("bordered"); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),2); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),1); - //### we should be checking that this is an implicit rather than explicit 1 (which currently fails) - - rect->setState("bordered"); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),2); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),1); - - } -} - -void tst_qmlstates::basicExtension() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),1); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),1); - - rect->setState("bordered"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),2); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),1); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),1); - - rect->setState("bordered"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->border()->width(),2); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->border()->width(),1); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/fakeExtension.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - } -} - -void tst_qmlstates::basicBinding() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - rect->setProperty("sourceColor", QColor("green")); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - rect->setProperty("sourceColor", QColor("yellow")); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("yellow")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding2.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - rect->setProperty("sourceColor", QColor("green")); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("green")); - rect->setProperty("sourceColor", QColor("yellow")); - QCOMPARE(rect->color(),QColor("yellow")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("yellow")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding3.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - rect->setProperty("sourceColor", QColor("green")); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - rect->setProperty("sourceColor", QColor("red")); - QCOMPARE(rect->color(),QColor("blue")); - rect->setProperty("sourceColor2", QColor("yellow")); - QCOMPARE(rect->color(),QColor("yellow")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - rect->setProperty("sourceColor2", QColor("green")); - QCOMPARE(rect->color(),QColor("red")); - rect->setProperty("sourceColor", QColor("yellow")); - QCOMPARE(rect->color(),QColor("yellow")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding4.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - rect->setProperty("sourceColor", QColor("yellow")); - QCOMPARE(rect->color(),QColor("yellow")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - rect->setProperty("sourceColor", QColor("purple")); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("purple")); - - rect->setState("green"); - QCOMPARE(rect->color(),QColor("green")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - } -} - -class MyRect : public QmlGraphicsRectangle -{ - Q_OBJECT -public: - MyRect() {} - void doSomething() { emit didSomething(); } -Q_SIGNALS: - void didSomething(); -}; - -QML_DECLARE_TYPE(MyRect) -QML_DEFINE_TYPE(Qt.test, 1, 0, MyRectangle,MyRect); - -void tst_qmlstates::signalOverride() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/signalOverride.qml"); - MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - rect->doSomething(); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState("green"); - rect->doSomething(); - QCOMPARE(rect->color(),QColor("green")); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/signalOverride2.qml"); - MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("white")); - rect->doSomething(); - QCOMPARE(rect->color(),QColor("blue")); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("extendedRect")); - - innerRect->setState("green"); - rect->doSomething(); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(innerRect->color(),QColor("green")); - QCOMPARE(innerRect->property("extendedColor").value<QColor>(),QColor("green")); - } -} - -void tst_qmlstates::signalOverrideCrash() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/signalOverrideCrash.qml"); - MyRect *rect = qobject_cast<MyRect*>(rectComponent.create()); - QVERIFY(rect != 0); - - rect->setState("overridden"); - rect->doSomething(); -} - -void tst_qmlstates::parentChange() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/parentChange.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlParentChange *pChange = qobject_cast<QmlParentChange*>(state->operationAt(0)); - QVERIFY(pChange != 0); - QmlGraphicsItem *nParent = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("NewParent")); - QVERIFY(nParent != 0); - - QCOMPARE(pChange->parent(), nParent); - - rect->setState("reparented"); - QCOMPARE(innerRect->rotation(), qreal(0)); - QCOMPARE(innerRect->scale(), qreal(1)); - QCOMPARE(innerRect->x(), qreal(-133)); - QCOMPARE(innerRect->y(), qreal(-300)); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/parentChange2.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - rect->setState("reparented"); - QCOMPARE(innerRect->rotation(), qreal(15)); - QCOMPARE(innerRect->scale(), qreal(.5)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(12.4148145657)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(10.6470476128)); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/parentChange3.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - rect->setState("reparented"); - QCOMPARE(innerRect->rotation(), qreal(-37)); - QCOMPARE(innerRect->scale(), qreal(.25)); - QCOMPARE(QString("%1").arg(innerRect->x()), QString("%1").arg(-217.305)); - QCOMPARE(QString("%1").arg(innerRect->y()), QString("%1").arg(-164.413)); - - rect->setState(""); - QCOMPARE(innerRect->rotation(), qreal(0)); - QCOMPARE(innerRect->scale(), qreal(1)); - QCOMPARE(innerRect->x(), qreal(5)); - QEXPECT_FAIL("", "QTBUG-2919", Continue); - QCOMPARE(innerRect->y(), qreal(0)); - } -} - -void tst_qmlstates::parentChangeErrors() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/parentChange4.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange4.qml") + ":25:9) Unable to preserve appearance under non-uniform scale").constData()); - rect->setState("reparented"); - QCOMPARE(innerRect->rotation(), qreal(0)); - QCOMPARE(innerRect->scale(), qreal(1)); - QCOMPARE(innerRect->x(), qreal(5)); - QCOMPARE(innerRect->y(), qreal(5)); - } - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/parentChange5.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QTest::ignoreMessage(QtWarningMsg, QByteArray("QML ParentChange (" + fullDataPath("/data/parentChange5.qml") + ":25:9) Unable to preserve appearance under complex transform").constData()); - rect->setState("reparented"); - QCOMPARE(innerRect->rotation(), qreal(0)); - QCOMPARE(innerRect->scale(), qreal(1)); - QCOMPARE(innerRect->x(), qreal(5)); - QCOMPARE(innerRect->y(), qreal(5)); - } -} - -void tst_qmlstates::anchorChanges() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); - - rect->setState("right"); - QCOMPARE(innerRect->x(), qreal(150)); - QCOMPARE(aChanges->reset(), QString("left")); - QCOMPARE(aChanges->object(), innerRect); - QCOMPARE(aChanges->right().item, rect->right().item); - QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine); - - rect->setState(""); - QCOMPARE(innerRect->x(), qreal(5)); - - delete rect; -} - -void tst_qmlstates::anchorChanges2() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges2.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - rect->setState("right"); - QEXPECT_FAIL("", "QTBUG-5338", Continue); - QCOMPARE(innerRect->x(), qreal(150)); - - rect->setState(""); - QCOMPARE(innerRect->x(), qreal(5)); - - delete rect; -} - -void tst_qmlstates::anchorChanges3() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges3.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QmlGraphicsItem *leftGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); - - QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); - - rect->setState("reanchored"); - QCOMPARE(aChanges->object(), innerRect); - QCOMPARE(aChanges->left().item, leftGuideline->left().item); - QCOMPARE(aChanges->left().anchorLine, leftGuideline->left().anchorLine); - QCOMPARE(aChanges->right().item, rect->right().item); - QCOMPARE(aChanges->right().anchorLine, rect->right().anchorLine); - QCOMPARE(aChanges->top().item, rect->top().item); - QCOMPARE(aChanges->top().anchorLine, rect->top().anchorLine); - QCOMPARE(aChanges->bottom().item, bottomGuideline->bottom().item); - QCOMPARE(aChanges->bottom().anchorLine, bottomGuideline->bottom().anchorLine); - - QCOMPARE(innerRect->x(), qreal(10)); - QCOMPARE(innerRect->y(), qreal(0)); - QCOMPARE(innerRect->width(), qreal(190)); - QCOMPARE(innerRect->height(), qreal(150)); - - rect->setState(""); - QCOMPARE(innerRect->x(), qreal(0)); - QCOMPARE(innerRect->y(), qreal(10)); - QCOMPARE(innerRect->width(), qreal(150)); - QCOMPARE(innerRect->height(), qreal(190)); - - delete rect; -} - -void tst_qmlstates::anchorChanges4() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges4.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QmlGraphicsItem *leftGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); - - QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); - - rect->setState("reanchored"); - QCOMPARE(aChanges->object(), innerRect); - QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item); - QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); - QCOMPARE(aChanges->verticalCenter().item, leftGuideline->verticalCenter().item); - QCOMPARE(aChanges->verticalCenter().anchorLine, leftGuideline->verticalCenter().anchorLine); - - delete rect; -} - -void tst_qmlstates::anchorChanges5() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/anchorChanges5.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlGraphicsRectangle *innerRect = qobject_cast<QmlGraphicsRectangle*>(rect->findChild<QmlGraphicsRectangle*>("MyRect")); - QVERIFY(innerRect != 0); - - QmlGraphicsItem *leftGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("LeftGuideline")); - QVERIFY(leftGuideline != 0); - - QmlGraphicsItem *bottomGuideline = qobject_cast<QmlGraphicsItem*>(rect->findChild<QmlGraphicsItem*>("BottomGuideline")); - QVERIFY(bottomGuideline != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlAnchorChanges *aChanges = qobject_cast<QmlAnchorChanges*>(state->operationAt(0)); - QVERIFY(aChanges != 0); - - rect->setState("reanchored"); - QCOMPARE(aChanges->object(), innerRect); - QCOMPARE(aChanges->horizontalCenter().item, bottomGuideline->horizontalCenter().item); - QCOMPARE(aChanges->horizontalCenter().anchorLine, bottomGuideline->horizontalCenter().anchorLine); - QCOMPARE(aChanges->baseline().item, leftGuideline->baseline().item); - QCOMPARE(aChanges->baseline().anchorLine, leftGuideline->baseline().anchorLine); - - delete rect; -} - -void tst_qmlstates::script() -{ - QmlEngine engine; - - { - QmlComponent rectComponent(&engine, SRCDIR "/data/script.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("blue")); // a script isn't reverted - } -} - -void tst_qmlstates::restoreEntryValues() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/restoreEntryValues.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("blue")); -} - -void tst_qmlstates::explicitChanges() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/explicit.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlListReference list(rect, "states"); - QmlState *state = qobject_cast<QmlState*>(list.at(0)); - QVERIFY(state != 0); - - qmlExecuteDeferred(state); - QmlPropertyChanges *changes = qobject_cast<QmlPropertyChanges*>(rect->findChild<QmlPropertyChanges*>("changes")); - QVERIFY(changes != 0); - QVERIFY(changes->isExplicit()); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setProperty("sourceColor", QColor("green")); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - rect->setProperty("sourceColor", QColor("yellow")); - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("yellow")); -} - -void tst_qmlstates::propertyErrors() -{ - QmlEngine engine; - QmlComponent rectComponent(&engine, SRCDIR "/data/propertyErrors.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to non-existent property \"colr\"").constData()); - QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/propertyErrors.qml") + ":8:9) Cannot assign to read-only property \"wantsFocus\"").constData()); - rect->setState("blue"); -} - -void tst_qmlstates::incorrectRestoreBug() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QCOMPARE(rect->color(),QColor("red")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - // make sure if we change the base state value, we then restore to it correctly - rect->setColor(QColor("green")); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("green")); -} - -void tst_qmlstates::autoStateAtStartupRestoreBug() -{ - QmlEngine engine; - - QmlComponent component(&engine, SRCDIR "/data/autoStateAtStartupRestoreBug.qml"); - QObject *obj = component.create(); - - QVERIFY(obj != 0); - QCOMPARE(obj->property("test").toInt(), 3); - - obj->setProperty("input", 2); - - QCOMPARE(obj->property("test").toInt(), 9); - - delete obj; -} - -void tst_qmlstates::deletingChange() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/deleting.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - QCOMPARE(rect->radius(),qreal(5)); - - rect->setState(""); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->radius(),qreal(0)); - - QmlPropertyChanges *pc = rect->findChild<QmlPropertyChanges*>("pc1"); - QVERIFY(pc != 0); - delete pc; - - QmlState *state = rect->findChild<QmlState*>(); - QVERIFY(state != 0); - qmlExecuteDeferred(state); - QCOMPARE(state->operationCount(), 1); - - rect->setState("blue"); - QCOMPARE(rect->color(),QColor("red")); - QCOMPARE(rect->radius(),qreal(5)); - - delete rect; -} - -void tst_qmlstates::deletingState() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/deletingState.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QmlStateGroup *sg = rect->findChild<QmlStateGroup*>(); - QVERIFY(sg != 0); - QVERIFY(sg->findState("blue") != 0); - - sg->setState("blue"); - QCOMPARE(rect->color(),QColor("blue")); - - sg->setState(""); - QCOMPARE(rect->color(),QColor("red")); - - QmlState *state = rect->findChild<QmlState*>(); - QVERIFY(state != 0); - delete state; - - QVERIFY(sg->findState("blue") == 0); - - //### should we warn that state doesn't exist - sg->setState("blue"); - QCOMPARE(rect->color(),QColor("red")); - - delete rect; -} - -void tst_qmlstates::tempState() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/legalTempState.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QTest::ignoreMessage(QtDebugMsg, "entering placed"); - QTest::ignoreMessage(QtDebugMsg, "entering idle"); - rect->setState("placed"); - QCOMPARE(rect->state(), QLatin1String("idle")); -} - -void tst_qmlstates::illegalTempState() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/illegalTempState.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QTest::ignoreMessage(QtWarningMsg, "Can't apply a state change as part of a state definition. "); - rect->setState("placed"); - QCOMPARE(rect->state(), QLatin1String("placed")); -} - -void tst_qmlstates::nonExistantProperty() -{ - QmlEngine engine; - - QmlComponent rectComponent(&engine, SRCDIR "/data/nonExistantProp.qml"); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle*>(rectComponent.create()); - QVERIFY(rect != 0); - - QTest::ignoreMessage(QtWarningMsg, QByteArray("QML PropertyChanges (" + fullDataPath("/data/nonExistantProp.qml") + ":9:9) Cannot assign to non-existent property \"colr\"").constData()); - rect->setState("blue"); - QCOMPARE(rect->state(), QLatin1String("blue")); -} - -QTEST_MAIN(tst_qmlstates) - -#include "tst_qmlstates.moc" diff --git a/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro b/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro deleted file mode 100644 index 4d55b46..0000000 --- a/tests/auto/declarative/qmlsystempalette/qmlsystempalette.pro +++ /dev/null @@ -1,5 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlsystempalette.cpp diff --git a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp b/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp deleted file mode 100644 index 06e4d1c..0000000 --- a/tests/auto/declarative/qmlsystempalette/tst_qmlsystempalette.cpp +++ /dev/null @@ -1,187 +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 <qtest.h> -#include <QDebug> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlsystempalette_p.h> -#include <qpalette.h> -#include "../../../shared/util.h" - -class tst_qmlsystempalette : public QObject - -{ - Q_OBJECT -public: - tst_qmlsystempalette(); - -private slots: - void activePalette(); - void inactivePalette(); - void disabledPalette(); - void paletteChanged(); - -private: - QmlEngine engine; -}; - -tst_qmlsystempalette::tst_qmlsystempalette() -{ -} - -void tst_qmlsystempalette::activePalette() -{ - QString componentStr = "import Qt 4.6\nSystemPalette { }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); - - QVERIFY(object != 0); - - QPalette palette; - palette.setCurrentColorGroup(QPalette::Active); - QCOMPARE(palette.window().color(), object->window()); - QCOMPARE(palette.windowText().color(), object->windowText()); - QCOMPARE(palette.base().color(), object->base()); - QCOMPARE(palette.text().color(), object->text()); - QCOMPARE(palette.alternateBase().color(), object->alternateBase()); - QCOMPARE(palette.button().color(), object->button()); - QCOMPARE(palette.buttonText().color(), object->buttonText()); - QCOMPARE(palette.light().color(), object->light()); - QCOMPARE(palette.midlight().color(), object->midlight()); - QCOMPARE(palette.dark().color(), object->dark()); - QCOMPARE(palette.mid().color(), object->mid()); - QCOMPARE(palette.shadow().color(), object->shadow()); - QCOMPARE(palette.highlight().color(), object->highlight()); - QCOMPARE(palette.highlightedText().color(), object->highlightedText()); - - delete object; -} - -void tst_qmlsystempalette::inactivePalette() -{ - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Inactive }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); - - QVERIFY(object != 0); - QVERIFY(object->colorGroup() == QmlSystemPalette::Inactive); - - QPalette palette; - palette.setCurrentColorGroup(QPalette::Inactive); - QCOMPARE(palette.window().color(), object->window()); - QCOMPARE(palette.windowText().color(), object->windowText()); - QCOMPARE(palette.base().color(), object->base()); - QCOMPARE(palette.text().color(), object->text()); - QCOMPARE(palette.alternateBase().color(), object->alternateBase()); - QCOMPARE(palette.button().color(), object->button()); - QCOMPARE(palette.buttonText().color(), object->buttonText()); - QCOMPARE(palette.light().color(), object->light()); - QCOMPARE(palette.midlight().color(), object->midlight()); - QCOMPARE(palette.dark().color(), object->dark()); - QCOMPARE(palette.mid().color(), object->mid()); - QCOMPARE(palette.shadow().color(), object->shadow()); - QCOMPARE(palette.highlight().color(), object->highlight()); - QCOMPARE(palette.highlightedText().color(), object->highlightedText()); - - delete object; -} - -void tst_qmlsystempalette::disabledPalette() -{ - QString componentStr = "import Qt 4.6\nSystemPalette { colorGroup: SystemPalette.Disabled }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); - - QVERIFY(object != 0); - QVERIFY(object->colorGroup() == QmlSystemPalette::Disabled); - - QPalette palette; - palette.setCurrentColorGroup(QPalette::Disabled); - QCOMPARE(palette.window().color(), object->window()); - QCOMPARE(palette.windowText().color(), object->windowText()); - QCOMPARE(palette.base().color(), object->base()); - QCOMPARE(palette.text().color(), object->text()); - QCOMPARE(palette.alternateBase().color(), object->alternateBase()); - QCOMPARE(palette.button().color(), object->button()); - QCOMPARE(palette.buttonText().color(), object->buttonText()); - QCOMPARE(palette.light().color(), object->light()); - QCOMPARE(palette.midlight().color(), object->midlight()); - QCOMPARE(palette.dark().color(), object->dark()); - QCOMPARE(palette.mid().color(), object->mid()); - QCOMPARE(palette.shadow().color(), object->shadow()); - QCOMPARE(palette.highlight().color(), object->highlight()); - QCOMPARE(palette.highlightedText().color(), object->highlightedText()); - - delete object; -} - -void tst_qmlsystempalette::paletteChanged() -{ - QString componentStr = "import Qt 4.6\nSystemPalette { }"; - QmlComponent component(&engine); - component.setData(componentStr.toLatin1(), QUrl::fromLocalFile("")); - QmlSystemPalette *object = qobject_cast<QmlSystemPalette*>(component.create()); - - QVERIFY(object != 0); - - QPalette p; - p.setCurrentColorGroup(QPalette::Active); - p.setColor(QPalette::Active, QPalette::Text, QColor("red")); - p.setColor(QPalette::Active, QPalette::ButtonText, QColor("green")); - p.setColor(QPalette::Active, QPalette::WindowText, QColor("blue")); - - qApp->setPalette(p); - - object->setColorGroup(QmlSystemPalette::Active); - QTRY_COMPARE(QColor("red"), object->text()); - QTRY_COMPARE(QColor("green"), object->buttonText()); - QTRY_COMPARE(QColor("blue"), object->windowText()); - - delete object; -} - -QTEST_MAIN(tst_qmlsystempalette) - -#include "tst_qmlsystempalette.moc" diff --git a/tests/auto/declarative/qmltimer/qmltimer.pro b/tests/auto/declarative/qmltimer/qmltimer.pro deleted file mode 100644 index 2b244ed..0000000 --- a/tests/auto/declarative/qmltimer/qmltimer.pro +++ /dev/null @@ -1,7 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -macx:CONFIG -= app_bundle - -SOURCES += tst_qmltimer.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp b/tests/auto/declarative/qmltimer/tst_qmltimer.cpp deleted file mode 100644 index b8b5e62..0000000 --- a/tests/auto/declarative/qmltimer/tst_qmltimer.cpp +++ /dev/null @@ -1,285 +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 <qtest.h> -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmltimer_p.h> -#include <QDebug> - -class tst_qmltimer : public QObject -{ - Q_OBJECT -public: - tst_qmltimer(); - -private slots: - void notRepeating(); - void notRepeatingStart(); - void repeat(); - void noTriggerIfNotRunning(); - void triggeredOnStart(); - void triggeredOnStartRepeat(); - void changeDuration(); - void restart(); -}; - -class TimerHelper : public QObject -{ - Q_OBJECT -public: - TimerHelper() : QObject(), count(0) - { - } - - int count; - -public slots: - void timeout() { - ++count; - } -}; - -#if defined(Q_OS_SYMBIAN) && defined(Q_CC_NOKIAX86) -// Increase wait as emulator startup can cause unexpected delays -#define TIMEOUT_TIMEOUT 2000 -#else -#define TIMEOUT_TIMEOUT 200 -#endif - -tst_qmltimer::tst_qmltimer() -{ -} - -void tst_qmltimer::notRepeating() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - QVERIFY(timer->isRunning()); - QVERIFY(!timer->isRepeating()); - QCOMPARE(timer->interval(), 100); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 1); - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 1); - QVERIFY(timer->isRunning() == false); -} - -void tst_qmltimer::notRepeatingStart() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100 }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - QVERIFY(!timer->isRunning()); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 0); - - timer->start(); - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 1); - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 1); - QVERIFY(timer->isRunning() == false); - - delete timer; -} - -void tst_qmltimer::repeat() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - QCOMPARE(helper.count, 0); - - QTest::qWait(TIMEOUT_TIMEOUT); - QVERIFY(helper.count > 0); - int oldCount = helper.count; - - QTest::qWait(TIMEOUT_TIMEOUT); - QVERIFY(helper.count > oldCount); - QVERIFY(timer->isRunning()); - - oldCount = helper.count; - timer->stop(); - - QTest::qWait(TIMEOUT_TIMEOUT); - QVERIFY(helper.count == oldCount); - QVERIFY(timer->isRunning() == false); - - delete timer; -} - -void tst_qmltimer::triggeredOnStart() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - QVERIFY(timer->triggeredOnStart()); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - QTest::qWait(1); - QCOMPARE(helper.count, 1); - - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 2); - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(helper.count, 2); - QVERIFY(timer->isRunning() == false); - - delete timer; -} - -void tst_qmltimer::triggeredOnStartRepeat() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 100; running: true; triggeredOnStart: true; repeat: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - QTest::qWait(1); - QCOMPARE(helper.count, 1); - - QTest::qWait(TIMEOUT_TIMEOUT); - QVERIFY(helper.count > 1); - int oldCount = helper.count; - QTest::qWait(TIMEOUT_TIMEOUT); - QVERIFY(helper.count > oldCount); - QVERIFY(timer->isRunning()); - - delete timer; -} - -void tst_qmltimer::noTriggerIfNotRunning() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray( - "import Qt 4.6\n" - "Item { property bool ok: true\n" - "Timer { id: t1; interval: 100; repeat: true; running: true; onTriggered: if (!running) ok=false }" - "Timer { interval: 10; running: true; onTriggered: t1.running=false }" - "}" - ), QUrl::fromLocalFile("")); - QObject *item = component.create(); - QVERIFY(item != 0); - QTest::qWait(TIMEOUT_TIMEOUT); - QCOMPARE(item->property("ok").toBool(), true); - - delete item; -} - -void tst_qmltimer::changeDuration() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 200; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - QCOMPARE(helper.count, 0); - - QTest::qWait(500); - QCOMPARE(helper.count, 2); - - timer->setInterval(500); - - QTest::qWait(600); - QCOMPARE(helper.count, 3); - QVERIFY(timer->isRunning()); - - delete timer; -} - -void tst_qmltimer::restart() -{ - QmlEngine engine; - QmlComponent component(&engine); - component.setData(QByteArray("import Qt 4.6\nTimer { interval: 500; repeat: true; running: true }"), QUrl::fromLocalFile("")); - QmlTimer *timer = qobject_cast<QmlTimer*>(component.create()); - QVERIFY(timer != 0); - - TimerHelper helper; - connect(timer, SIGNAL(triggered()), &helper, SLOT(timeout())); - QCOMPARE(helper.count, 0); - - QTest::qWait(600); - QCOMPARE(helper.count, 1); - - QTest::qWait(300); - - timer->restart(); - - QTest::qWait(700); - - QCOMPARE(helper.count, 2); - QVERIFY(timer->isRunning()); - - delete timer; -} - -QTEST_MAIN(tst_qmltimer) - -#include "tst_qmltimer.moc" diff --git a/tests/auto/declarative/qmlvaluetypes/qmlvaluetypes.pro b/tests/auto/declarative/qmlvaluetypes/qmlvaluetypes.pro deleted file mode 100644 index 82d067e..0000000 --- a/tests/auto/declarative/qmlvaluetypes/qmlvaluetypes.pro +++ /dev/null @@ -1,10 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative -macx:CONFIG -= app_bundle - -HEADERS += testtypes.h - -SOURCES += tst_qmlvaluetypes.cpp \ - testtypes.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlvaluetypes/testtypes.cpp b/tests/auto/declarative/qmlvaluetypes/testtypes.cpp deleted file mode 100644 index c51b777..0000000 --- a/tests/auto/declarative/qmlvaluetypes/testtypes.cpp +++ /dev/null @@ -1,45 +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" - -QML_DEFINE_TYPE(Test, 1, 0, MyTypeObject, MyTypeObject); -QML_DEFINE_TYPE(Test, 1, 0, MyConstantValueSource, MyConstantValueSource); -QML_DEFINE_TYPE(Test, 1, 0, MyOffsetValueInterceptor, MyOffsetValueInterceptor); diff --git a/tests/auto/declarative/qmlvaluetypes/testtypes.h b/tests/auto/declarative/qmlvaluetypes/testtypes.h deleted file mode 100644 index b57fbff..0000000 --- a/tests/auto/declarative/qmlvaluetypes/testtypes.h +++ /dev/null @@ -1,152 +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$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <QObject> -#include <QPoint> -#include <QPointF> -#include <QSize> -#include <QSizeF> -#include <QRect> -#include <QRectF> -#include <QVector3D> -#include <QFont> -#include <qml.h> -#include <QmlPropertyValueSource> - -class MyTypeObject : public QObject -{ - Q_OBJECT - - Q_PROPERTY(QPoint point READ point WRITE setPoint NOTIFY changed); - Q_PROPERTY(QPointF pointf READ pointf WRITE setPointf NOTIFY changed); - Q_PROPERTY(QSize size READ size WRITE setSize NOTIFY changed); - Q_PROPERTY(QSizeF sizef READ sizef WRITE setSizef NOTIFY changed); - Q_PROPERTY(QRect rect READ rect WRITE setRect NOTIFY changed); - Q_PROPERTY(QRectF rectf READ rectf WRITE setRectf NOTIFY changed); - Q_PROPERTY(QVector3D vector READ vector WRITE setVector NOTIFY changed); - Q_PROPERTY(QFont font READ font WRITE setFont NOTIFY changed); - -public: - MyTypeObject() : - m_point(10, 4), - m_pointf(11.3, -10.9), - m_size(1912, 1913), - m_sizef(0.1, 100923.2), - m_rect(2, 3, 109, 102), - m_rectf(103.8, 99.2, 88.1, 77.6), - m_vector(23.88, 3.1, 4.3) - { - m_font.setFamily("Arial"); - m_font.setBold(true); - m_font.setWeight(QFont::DemiBold); - m_font.setItalic(true); - m_font.setUnderline(true); - m_font.setOverline(true); - m_font.setStrikeOut(true); - m_font.setPointSize(29); - m_font.setCapitalization(QFont::AllUppercase); - m_font.setLetterSpacing(QFont::AbsoluteSpacing, 10.2); - m_font.setWordSpacing(19.7); - } - - QPoint m_point; - QPoint point() const { return m_point; } - void setPoint(const QPoint &v) { m_point = v; emit changed(); } - - QPointF m_pointf; - QPointF pointf() const { return m_pointf; } - void setPointf(const QPointF &v) { m_pointf = v; emit changed(); } - - QSize m_size; - QSize size() const { return m_size; } - void setSize(const QSize &v) { m_size = v; emit changed(); } - - QSizeF m_sizef; - QSizeF sizef() const { return m_sizef; } - void setSizef(const QSizeF &v) { m_sizef = v; emit changed(); } - - QRect m_rect; - QRect rect() const { return m_rect; } - void setRect(const QRect &v) { m_rect = v; emit changed(); } - - QRectF m_rectf; - QRectF rectf() const { return m_rectf; } - void setRectf(const QRectF &v) { m_rectf = v; emit changed(); } - - QVector3D m_vector; - QVector3D vector() const { return m_vector; } - void setVector(const QVector3D &v) { m_vector = v; emit changed(); } - - QFont m_font; - QFont font() const { return m_font; } - void setFont(const QFont &v) { m_font = v; emit changed(); } - - void emitRunScript() { emit runScript(); } - -signals: - void changed(); - void runScript(); -}; -QML_DECLARE_TYPE(MyTypeObject); - -class MyConstantValueSource : public QObject, public QmlPropertyValueSource -{ - Q_OBJECT -public: - virtual void setTarget(const QmlMetaProperty &p) { p.write(3345); } -}; -QML_DECLARE_TYPE(MyConstantValueSource); - -class MyOffsetValueInterceptor : public QObject, public QmlPropertyValueInterceptor -{ - Q_OBJECT -public: - virtual void setTarget(const QmlMetaProperty &p) { prop = p; } - virtual void write(const QVariant &value) { prop.write(value.toInt() + 13, QmlMetaProperty::BypassInterceptor); } - -private: - QmlMetaProperty prop; -}; -QML_DECLARE_TYPE(MyOffsetValueInterceptor); - -#endif // TESTTYPES_H diff --git a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp b/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp deleted file mode 100644 index f99d3ce..0000000 --- a/tests/auto/declarative/qmlvaluetypes/tst_qmlvaluetypes.cpp +++ /dev/null @@ -1,588 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QDebug> -#include <private/qmlvaluetype_p.h> -#include "testtypes.h" - -class tst_qmlvaluetypes : public QObject -{ - Q_OBJECT -public: - tst_qmlvaluetypes() {} - -private slots: - void point(); - void pointf(); - void size(); - void sizef(); - void rect(); - void rectf(); - void vector3d(); - void font(); - - void bindingAssignment(); - void bindingRead(); - void staticAssignment(); - void scriptAccess(); - void autoBindingRemoval(); - void valueSources(); - void valueInterceptors(); - void bindingConflict(); - void deletedObject(); - void bindingVariantCopy(); - void scriptVariantCopy(); - void cppClasses(); - -private: - QmlEngine engine; -}; - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -void tst_qmlvaluetypes::point() -{ - { - QmlComponent component(&engine, TEST_FILE("point_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("p_x").toInt(), 10); - QCOMPARE(object->property("p_y").toInt(), 4); - QCOMPARE(object->property("copy"), QVariant(QPoint(10, 4))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("point_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->point(), QPoint(11, 12)); - - delete object; - } -} - -void tst_qmlvaluetypes::pointf() -{ - { - QmlComponent component(&engine, TEST_FILE("pointf_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("p_x").toDouble(), 11.3); - QCOMPARE(object->property("p_y").toDouble(), -10.9); - QCOMPARE(object->property("copy"), QVariant(QPointF(11.3, -10.9))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("pointf_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->pointf(), QPointF(6.8, 9.3)); - - delete object; - } -} - -void tst_qmlvaluetypes::size() -{ - { - QmlComponent component(&engine, TEST_FILE("size_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("s_width").toInt(), 1912); - QCOMPARE(object->property("s_height").toInt(), 1913); - QCOMPARE(object->property("copy"), QVariant(QSize(1912, 1913))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("size_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->size(), QSize(13, 88)); - - delete object; - } -} - -void tst_qmlvaluetypes::sizef() -{ - { - QmlComponent component(&engine, TEST_FILE("sizef_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("s_width").toDouble(), 0.1); - QCOMPARE(object->property("s_height").toDouble(), 100923.2); - QCOMPARE(object->property("copy"), QVariant(QSizeF(0.1, 100923.2))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("sizef_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->sizef(), QSizeF(44.3, 92.8)); - - delete object; - } -} - -void tst_qmlvaluetypes::rect() -{ - { - QmlComponent component(&engine, TEST_FILE("rect_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("r_x").toInt(), 2); - QCOMPARE(object->property("r_y").toInt(), 3); - QCOMPARE(object->property("r_width").toInt(), 109); - QCOMPARE(object->property("r_height").toInt(), 102); - QCOMPARE(object->property("copy"), QVariant(QRect(2, 3, 109, 102))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("rect_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(1234, 7, 56, 63)); - - delete object; - } -} - -void tst_qmlvaluetypes::rectf() -{ - { - QmlComponent component(&engine, TEST_FILE("rectf_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("r_x").toDouble(), 103.8); - QCOMPARE(object->property("r_y").toDouble(), 99.2); - QCOMPARE(object->property("r_width").toDouble(), 88.1); - QCOMPARE(object->property("r_height").toDouble(), 77.6); - QCOMPARE(object->property("copy"), QVariant(QRectF(103.8, 99.2, 88.1, 77.6))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("rectf_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rectf(), QRectF(70.1, -113.2, 80924.8, 99.2)); - - delete object; - } -} - -void tst_qmlvaluetypes::vector3d() -{ - { - QmlComponent component(&engine, TEST_FILE("vector3d_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE((float)object->property("v_x").toDouble(), (float)23.88); - QCOMPARE((float)object->property("v_y").toDouble(), (float)3.1); - QCOMPARE((float)object->property("v_z").toDouble(), (float)4.3); - QCOMPARE(object->property("copy"), QVariant(QVector3D(23.88, 3.1, 4.3))); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("vector3d_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->vector(), QVector3D(-0.3, -12.9, 907.4)); - - delete object; - } -} - -void tst_qmlvaluetypes::font() -{ - { - QmlComponent component(&engine, TEST_FILE("font_read.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("f_family").toString(), object->font().family()); - QCOMPARE(object->property("f_bold").toBool(), object->font().bold()); - QCOMPARE(object->property("f_weight").toInt(), object->font().weight()); - QCOMPARE(object->property("f_italic").toBool(), object->font().italic()); - QCOMPARE(object->property("f_underline").toBool(), object->font().underline()); - QCOMPARE(object->property("f_overline").toBool(), object->font().overline()); - QCOMPARE(object->property("f_strikeout").toBool(), object->font().strikeOut()); - QCOMPARE(object->property("f_pointSize").toDouble(), object->font().pointSizeF()); - QCOMPARE(object->property("f_pixelSize").toInt(), object->font().pixelSize()); - QCOMPARE(object->property("f_capitalization").toInt(), (int)object->font().capitalization()); - QCOMPARE(object->property("f_letterSpacing").toDouble(), object->font().letterSpacing()); - QCOMPARE(object->property("f_wordSpacing").toDouble(), object->font().wordSpacing()); - - QCOMPARE(object->property("copy"), QVariant(object->font())); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("font_write.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QFont font; - font.setFamily("Helvetica"); - font.setBold(false); - font.setWeight(QFont::Normal); - font.setItalic(false); - font.setUnderline(false); - font.setStrikeOut(false); - font.setPointSize(15); - font.setCapitalization(QFont::AllLowercase); - font.setLetterSpacing(QFont::AbsoluteSpacing, 9.7); - font.setWordSpacing(11.2); - - QEXPECT_FAIL("", "QT-2920", Continue); - QCOMPARE(object->font(), font); - - delete object; - } - - // Test pixelSize - { - QmlComponent component(&engine, TEST_FILE("font_write.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->font().pixelSize(), 10); - - delete object; - } - - // Test pixelSize and pointSize - { - QmlComponent component(&engine, TEST_FILE("font_write.3.qml")); - QTest::ignoreMessage(QtWarningMsg, "Both point size and pixel size set. Using pixel size. "); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->font().pixelSize(), 10); - - delete object; - } -} - -// Test bindings can write to value types -void tst_qmlvaluetypes::bindingAssignment() -{ - QmlComponent component(&engine, TEST_FILE("bindingAssignment.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(92)); - - QCOMPARE(object->rect().x(), 92); - - delete object; -} - -// Test bindings can read from value types -void tst_qmlvaluetypes::bindingRead() -{ - QmlComponent component(&engine, TEST_FILE("bindingRead.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("value").toInt(), 2); - - object->setRect(QRect(19, 3, 88, 2)); - - QCOMPARE(object->property("value").toInt(), 19); - - delete object; -} - -// Test static values can assign to value types -void tst_qmlvaluetypes::staticAssignment() -{ - QmlComponent component(&engine, TEST_FILE("staticAssignment.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 9); - - delete object; -} - -// Test scripts can read/write value types -void tst_qmlvaluetypes::scriptAccess() -{ - QmlComponent component(&engine, TEST_FILE("scriptAccess.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->property("valuePre").toInt(), 2); - QCOMPARE(object->rect().x(), 19); - QCOMPARE(object->property("valuePost").toInt(), 19); - - delete object; -} - -// Test that assigning a constant from script removes any binding -void tst_qmlvaluetypes::autoBindingRemoval() -{ - { - QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(13)); - - QCOMPARE(object->rect().x(), 13); - - object->emitRunScript(); - - QCOMPARE(object->rect().x(), 42); - - object->setProperty("value", QVariant(92)); - - QEXPECT_FAIL("", "QT-2920", Continue); - QCOMPARE(object->rect().x(), 42); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.2.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 10); - - object->setProperty("value", QVariant(13)); - - QCOMPARE(object->rect().x(), 13); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); - - object->setProperty("value", QVariant(92)); - - QCOMPARE(object->rect(), QRect(10, 10, 10, 10)); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("autoBindingRemoval.3.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - object->setProperty("value", QVariant(QRect(9, 22, 33, 44))); - - QCOMPARE(object->rect(), QRect(9, 22, 33, 44)); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); - - object->setProperty("value", QVariant(QRect(19, 3, 4, 8))); - - QEXPECT_FAIL("", "QT-2920", Continue); - QCOMPARE(object->rect(), QRect(44, 22, 33, 44)); - - delete object; - } - -} - -// Test that property value sources assign to value types -void tst_qmlvaluetypes::valueSources() -{ - QmlComponent component(&engine, TEST_FILE("valueSources.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect().x(), 3345); - - delete object; -} - -static void checkNoErrors(QmlComponent& component) -{ - QList<QmlError> errors = component.errors(); - if (errors.isEmpty()) - return; - for (int ii = 0; ii < errors.count(); ++ii) { - const QmlError &error = errors.at(ii); - qWarning("%d:%d:%s",error.line(),error.column(),error.description().toUtf8().constData()); - } -} - -// Test that property value interceptors can be applied to value types -void tst_qmlvaluetypes::valueInterceptors() -{ - QmlComponent 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); - - object->setProperty("value", 99); - - QCOMPARE(object->rect().x(), 112); - - delete object; -} - -// Test that you can't assign a binding to the "root" value type, and a sub-property -void tst_qmlvaluetypes::bindingConflict() -{ - QmlComponent component(&engine, TEST_FILE("bindingConflict.qml")); - QCOMPARE(component.isError(), true); -} - -#define CPP_TEST(type, v) \ -{ \ - type *t = new type; \ - QVariant value(v); \ - t->setValue(value); \ - QCOMPARE(t->value(), value); \ - delete t; \ -} - -// Test that accessing a reference to a valuetype after the owning object is deleted -// doesn't crash -void tst_qmlvaluetypes::deletedObject() -{ - QmlComponent component(&engine, TEST_FILE("deletedObject.qml")); - QTest::ignoreMessage(QtDebugMsg, "Test: 2"); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QObject *dObject = qvariant_cast<QObject *>(object->property("object")); - QVERIFY(dObject != 0); - delete dObject; - - QTest::ignoreMessage(QtDebugMsg, "Test: undefined"); - object->emitRunScript(); - - delete object; -} - -// Test that value types can be assigned to another value type property in a binding -void tst_qmlvaluetypes::bindingVariantCopy() -{ - QmlComponent component(&engine, TEST_FILE("bindingVariantCopy.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); - - delete object; -} - -// Test that value types can be assigned to another value type property in script -void tst_qmlvaluetypes::scriptVariantCopy() -{ - QmlComponent component(&engine, TEST_FILE("scriptVariantCopy.qml")); - MyTypeObject *object = qobject_cast<MyTypeObject *>(component.create()); - QVERIFY(object != 0); - - QCOMPARE(object->rect(), QRect(2, 3, 109, 102)); - - object->emitRunScript(); - - QCOMPARE(object->rect(), QRect(19, 33, 5, 99)); - - delete object; -} - - -// Test that the value type classes can be used manually -void tst_qmlvaluetypes::cppClasses() -{ - CPP_TEST(QmlPointValueType, QPoint(19, 33)); - CPP_TEST(QmlPointFValueType, QPointF(33.6, -23)); - CPP_TEST(QmlSizeValueType, QSize(-100, 18)); - CPP_TEST(QmlSizeFValueType, QSizeF(-100.7, 18.2)); - CPP_TEST(QmlRectValueType, QRect(13, 39, 10928, 88)); - CPP_TEST(QmlRectFValueType, QRectF(88.2, -90.1, 103.2, 118)); - CPP_TEST(QmlVector3DValueType, QVector3D(18.2, 19.7, 1002)); - CPP_TEST(QmlFontValueType, QFont("Helvetica")); - -} -QTEST_MAIN(tst_qmlvaluetypes) - -#include "tst_qmlvaluetypes.moc" diff --git a/tests/auto/declarative/qmlxmlhttprequest/qmlxmlhttprequest.pro b/tests/auto/declarative/qmlxmlhttprequest/qmlxmlhttprequest.pro deleted file mode 100644 index ed87b2a..0000000 --- a/tests/auto/declarative/qmlxmlhttprequest/qmlxmlhttprequest.pro +++ /dev/null @@ -1,13 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative network -macx:CONFIG -= app_bundle - -INCLUDEPATH += ../shared/ -HEADERS += ../shared/testhttpserver.h - -SOURCES += tst_qmlxmlhttprequest.cpp \ - ../shared/testhttpserver.cpp - - -# Define SRCDIR equal to test's source directory -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlxmlhttprequest/tst_qmlxmlhttprequest.cpp b/tests/auto/declarative/qmlxmlhttprequest/tst_qmlxmlhttprequest.cpp deleted file mode 100644 index e675566..0000000 --- a/tests/auto/declarative/qmlxmlhttprequest/tst_qmlxmlhttprequest.cpp +++ /dev/null @@ -1,1315 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QDebug> -#include <QNetworkCookieJar> -#include "testhttpserver.h" - -#define SERVER_PORT 14445 - -class tst_qmlxmlhttprequest : public QObject -{ - Q_OBJECT -public: - tst_qmlxmlhttprequest() {} - -private slots: - void initTestCase() { - if (QLocale::system().name().replace(QChar::fromAscii('_'),QChar::fromAscii('-')) != QLatin1String("en-US")) { - qWarning() << "Test will fail unless LANG is en_US"; - } - } - - void domExceptionCodes(); - void callbackException(); - void callbackException_data(); - void staticStateValues(); - void instanceStateValues(); - void constructor(); - void defaultState(); - void open(); - void open_invalid_method(); - void open_sync(); - void open_arg_count(); - void setRequestHeader(); - void setRequestHeader_unsent(); - void setRequestHeader_illegalName_data(); - void setRequestHeader_illegalName(); - void setRequestHeader_sent(); - void setRequestHeader_args(); - void send_unsent(); - void send_alreadySent(); - void send_ignoreData(); - void send_withdata(); - void abort(); - void abort_unsent(); - void abort_opened(); - void getResponseHeader(); - void getResponseHeader_unsent(); - void getResponseHeader_sent(); - void getResponseHeader_args(); - void getAllResponseHeaders(); - void getAllResponseHeaders_unsent(); - void getAllResponseHeaders_sent(); - void getAllResponseHeaders_args(); - void status(); - void statusText(); - void responseText(); - void responseXML_invalid(); - void invalidMethodUsage(); - void redirects(); - - // Attributes - void document(); - void element(); - void attr(); - void text(); - void cdata(); - - // Crashes - // void outstanding_request_at_shutdown(); - - // void network_errors() - // void readyState() - -private: - QmlEngine engine; -}; - -inline QUrl TEST_FILE(const QString &filename) -{ - return QUrl::fromLocalFile(QLatin1String(SRCDIR) + QLatin1String("/data/") + filename); -} - -// Test that the dom exception codes are correct -void tst_qmlxmlhttprequest::domExceptionCodes() -{ - QmlComponent component(&engine, TEST_FILE("domExceptionCodes.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("index_size_err").toInt(), 1); - QCOMPARE(object->property("domstring_size_err").toInt(), 2); - QCOMPARE(object->property("hierarchy_request_err").toInt(), 3); - QCOMPARE(object->property("wrong_document_err").toInt(), 4); - QCOMPARE(object->property("invalid_character_err").toInt(), 5); - QCOMPARE(object->property("no_data_allowed_err").toInt(), 6); - QCOMPARE(object->property("no_modification_allowed_err").toInt(), 7); - QCOMPARE(object->property("not_found_err").toInt(), 8); - QCOMPARE(object->property("not_supported_err").toInt(), 9); - QCOMPARE(object->property("inuse_attribute_err").toInt(), 10); - QCOMPARE(object->property("invalid_state_err").toInt(), 11); - QCOMPARE(object->property("syntax_err").toInt(), 12); - QCOMPARE(object->property("invalid_modification_err").toInt(), 13); - QCOMPARE(object->property("namespace_err").toInt(), 14); - QCOMPARE(object->property("invalid_access_err").toInt(), 15); - QCOMPARE(object->property("validation_err").toInt(), 16); - QCOMPARE(object->property("type_mismatch_err").toInt(), 17); - - delete object; -} - -#define TRY_WAIT(expr) \ - do { \ - for (int ii = 0; ii < 6; ++ii) { \ - if ((expr)) break; \ - QTest::qWait(50); \ - } \ - QVERIFY((expr)); \ - } while (false) - - -void tst_qmlxmlhttprequest::callbackException_data() -{ - QTest::addColumn<QString>("which"); - QTest::addColumn<int>("line"); - - QTest::newRow("on-opened") << "1" << 15; - QTest::newRow("on-loading") << "3" << 15; - QTest::newRow("on-done") << "4" << 15; -} - -void tst_qmlxmlhttprequest::callbackException() -{ - // Test exception reporting for exceptions thrown at various points. - - QFETCH(QString, which); - QFETCH(int, line); - - QString expect = TEST_FILE("callbackException.qml").toString() + ":"+QString::number(line)+": Error: Exception from Callback"; - QTest::ignoreMessage(QtWarningMsg, expect.toLatin1()); - - QmlComponent component(&engine, TEST_FILE("callbackException.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "testdocument.html"); - object->setProperty("which", which); - component.completeCreate(); - - TRY_WAIT(object->property("threw").toBool() == true); - - delete object; -} - -// Test that the state value properties on the XMLHttpRequest constructor have the correct values. -// ### WebKit does not do this, but it seems to fit the standard and QML better -void tst_qmlxmlhttprequest::staticStateValues() -{ - QmlComponent component(&engine, TEST_FILE("staticStateValues.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("unsent").toInt(), 0); - QCOMPARE(object->property("opened").toInt(), 1); - QCOMPARE(object->property("headers_received").toInt(), 2); - QCOMPARE(object->property("loading").toInt(), 3); - QCOMPARE(object->property("done").toInt(), 4); - - delete object; -} - -// Test that the state value properties on instances have the correct values. -void tst_qmlxmlhttprequest::instanceStateValues() -{ - QmlComponent component(&engine, TEST_FILE("instanceStateValues.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("unsent").toInt(), 0); - QCOMPARE(object->property("opened").toInt(), 1); - QCOMPARE(object->property("headers_received").toInt(), 2); - QCOMPARE(object->property("loading").toInt(), 3); - QCOMPARE(object->property("done").toInt(), 4); - - delete object; -} - -// Test calling constructor -void tst_qmlxmlhttprequest::constructor() -{ - QmlComponent component(&engine, TEST_FILE("constructor.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("calledAsConstructor").toBool(), true); - QCOMPARE(object->property("calledAsFunction").toBool(), true); - - delete object; -} - -// Test that all the properties are set correctly before any request is sent -void tst_qmlxmlhttprequest::defaultState() -{ - QmlComponent component(&engine, TEST_FILE("defaultState.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("readState").toInt(), 0); - QCOMPARE(object->property("statusIsException").toBool(), true); - QCOMPARE(object->property("statusTextIsException").toBool(), true); - QCOMPARE(object->property("responseText").toString(), QString()); - QCOMPARE(object->property("responseXMLIsNull").toBool(), true); - - delete object; -} - -// Test valid XMLHttpRequest.open() calls -void tst_qmlxmlhttprequest::open() -{ - // Relative url - { - QmlComponent component(&engine, TEST_FILE("open.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Absolute url - { - QmlComponent component(&engine, TEST_FILE("open.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", TEST_FILE("testdocument.html").toString()); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Absolute network url - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("open_network.expect"), - TEST_FILE("open_network.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("open.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // User/pass - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("open_network.expect"), - TEST_FILE("open_network.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("open_user.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - // ### Check that the username/password were sent to the server - - delete object; - } -} - -// Test that calling XMLHttpRequest.open() with an invalid method raises an exception -void tst_qmlxmlhttprequest::open_invalid_method() -{ - QmlComponent component(&engine, TEST_FILE("open_invalid_method.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("exceptionThrown").toBool(), true); - - delete object; -} - -// Test that calling XMLHttpRequest.open() with sync raises an exception -void tst_qmlxmlhttprequest::open_sync() -{ - QmlComponent component(&engine, TEST_FILE("open_sync.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("exceptionThrown").toBool(), true); - - delete object; -} - -// Calling with incorrect arg count raises an exception -void tst_qmlxmlhttprequest::open_arg_count() -{ - { - QmlComponent component(&engine, TEST_FILE("open_arg_count.1.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("exceptionThrown").toBool(), true); - - delete object; - } - - { - QmlComponent component(&engine, TEST_FILE("open_arg_count.2.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("exceptionThrown").toBool(), true); - - delete object; - } -} - -// Test valid setRequestHeader() calls -void tst_qmlxmlhttprequest::setRequestHeader() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("setRequestHeader.expect"), - TEST_FILE("setRequestHeader.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("setRequestHeader.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Test setting headers before open() throws exception -void tst_qmlxmlhttprequest::setRequestHeader_unsent() -{ - QmlComponent component(&engine, TEST_FILE("setRequestHeader_unsent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -void tst_qmlxmlhttprequest::setRequestHeader_illegalName_data() -{ - QTest::addColumn<QString>("name"); - - QTest::newRow("Accept-Charset") << "AccePT-CHArset"; - QTest::newRow("Accept-Encoding") << "AccEpt-EnCOding"; - QTest::newRow("Connection") << "ConnECtion"; - QTest::newRow("Content-Length") << "ContEnt-LenGth"; - QTest::newRow("Cookie") << "CookIe"; - QTest::newRow("Cookie2") << "CoOkie2"; - QTest::newRow("Content-Transfer-Encoding") << "ConteNT-tRANSFER-eNCOding"; - QTest::newRow("Date") << "DaTE"; - QTest::newRow("Expect") << "ExPect"; - QTest::newRow("Host") << "HoST"; - QTest::newRow("Keep-Alive") << "KEEP-aLive"; - QTest::newRow("Referer") << "ReferEr"; - QTest::newRow("TE") << "Te"; - QTest::newRow("Trailer") << "TraILEr"; - QTest::newRow("Transfer-Encoding") << "tRANsfer-Encoding"; - QTest::newRow("Upgrade") << "UpgrADe"; - QTest::newRow("User-Agent") << "uSEr-Agent"; - QTest::newRow("Via") << "vIa"; - QTest::newRow("Proxy-") << "ProXy-"; - QTest::newRow("Sec-") << "SeC-"; - QTest::newRow("Proxy-*") << "Proxy-BLAH"; - QTest::newRow("Sec-*") << "Sec-F"; -} - -// Tests that using illegal header names has no effect -void tst_qmlxmlhttprequest::setRequestHeader_illegalName() -{ - QFETCH(QString, name); - - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("open_network.expect"), - TEST_FILE("open_network.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("setRequestHeader_illegalName.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("header", name); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Test that attempting to set a header after a request is sent throws an exception -void tst_qmlxmlhttprequest::setRequestHeader_sent() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("open_network.expect"), - TEST_FILE("open_network.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("setRequestHeader_sent.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("test").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Invalid arg count throws exception -void tst_qmlxmlhttprequest::setRequestHeader_args() -{ - QmlComponent component(&engine, TEST_FILE("setRequestHeader_args.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("exceptionThrown").toBool(), true); - - delete object; -} - -// Test that calling send() in UNSENT state throws an exception -void tst_qmlxmlhttprequest::send_unsent() -{ - QmlComponent component(&engine, TEST_FILE("send_unsent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -// Test attempting to resend a sent request throws an exception -void tst_qmlxmlhttprequest::send_alreadySent() -{ - QmlComponent component(&engine, TEST_FILE("send_alreadySent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Test that send for a GET or HEAD ignores data -void tst_qmlxmlhttprequest::send_ignoreData() -{ - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_ignoreData_GET.expect"), - TEST_FILE("send_ignoreData.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_ignoreData.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("reqType", "GET"); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_ignoreData_PUT.expect"), - TEST_FILE("send_ignoreData.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_ignoreData.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("reqType", "HEAD"); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } -} - -// Test that send()'ing data works -void tst_qmlxmlhttprequest::send_withdata() -{ - // No content-type - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.1.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Correct content-type - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.2.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Incorrect content-type - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.3.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Correct content-type - out of order - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.4.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.4.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Incorrect content-type - out of order - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.4.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.5.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // PUT - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.6.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.6.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } - - // Correct content-type - no charset - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("send_data.1.expect"), - TEST_FILE("send_data.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("send_data.7.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; - } -} - -// Test abort() has no effect in unsent state -void tst_qmlxmlhttprequest::abort_unsent() -{ - QmlComponent component(&engine, TEST_FILE("abort_unsent.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Test abort() cancels an open (but unsent) request -void tst_qmlxmlhttprequest::abort_opened() -{ - QmlComponent component(&engine, TEST_FILE("abort_opened.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -// Test abort() aborts in progress send -void tst_qmlxmlhttprequest::abort() -{ - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("abort.expect"), - TEST_FILE("abort.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("abort.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("urlDummy", "http://127.0.0.1:14449/testdocument.html"); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("seenDone").toBool(), true); - QCOMPARE(object->property("didNotSeeUnsent").toBool(), true); - QCOMPARE(object->property("endStateUnsent").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - delete object; -} - -void tst_qmlxmlhttprequest::getResponseHeader() -{ - QmlEngine engine; // Avoid cookie contamination - - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"), - TEST_FILE("getResponseHeader.reply"), - TEST_FILE("testdocument.html"))); - - - QmlComponent component(&engine, TEST_FILE("getResponseHeader.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("headersReceivedState").toBool(), true); - QCOMPARE(object->property("headersReceivedNullHeader").toBool(), true); - QCOMPARE(object->property("headersReceivedValidHeader").toBool(), true); - QCOMPARE(object->property("headersReceivedMultiValidHeader").toBool(), true); - QCOMPARE(object->property("headersReceivedCookieHeader").toBool(), true); - - QCOMPARE(object->property("doneState").toBool(), true); - QCOMPARE(object->property("doneNullHeader").toBool(), true); - QCOMPARE(object->property("doneValidHeader").toBool(), true); - QCOMPARE(object->property("doneMultiValidHeader").toBool(), true); - QCOMPARE(object->property("doneCookieHeader").toBool(), true); - - delete object; -} - -// Test getResponseHeader throws an exception in an invalid state -void tst_qmlxmlhttprequest::getResponseHeader_unsent() -{ - QmlComponent component(&engine, TEST_FILE("getResponseHeader_unsent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -// Test getResponseHeader throws an exception in an invalid state -void tst_qmlxmlhttprequest::getResponseHeader_sent() -{ - QmlComponent component(&engine, TEST_FILE("getResponseHeader_sent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -// Invalid arg count throws exception -void tst_qmlxmlhttprequest::getResponseHeader_args() -{ - QmlComponent component(&engine, TEST_FILE("getResponseHeader_args.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("exceptionThrown").toBool() == true); - - delete object; -} - -void tst_qmlxmlhttprequest::getAllResponseHeaders() -{ - QmlEngine engine; // Avoid cookie contamination - - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("getResponseHeader.expect"), - TEST_FILE("getResponseHeader.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("getAllResponseHeaders.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - component.completeCreate(); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("openedState").toBool(), true); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("headersReceivedState").toBool(), true); - QCOMPARE(object->property("headersReceivedHeader").toBool(), true); - - QCOMPARE(object->property("doneState").toBool(), true); - QCOMPARE(object->property("doneHeader").toBool(), true); - - delete object; -} - -// Test getAllResponseHeaders throws an exception in an invalid state -void tst_qmlxmlhttprequest::getAllResponseHeaders_unsent() -{ - QmlComponent component(&engine, TEST_FILE("getAllResponseHeaders_unsent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -// Test getAllResponseHeaders throws an exception in an invalid state -void tst_qmlxmlhttprequest::getAllResponseHeaders_sent() -{ - QmlComponent component(&engine, TEST_FILE("getAllResponseHeaders_sent.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("test").toBool(), true); - - delete object; -} - -// Invalid arg count throws exception -void tst_qmlxmlhttprequest::getAllResponseHeaders_args() -{ - QmlComponent component(&engine, TEST_FILE("getAllResponseHeaders_args.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("exceptionThrown").toBool() == true); - - delete object; -} - -void tst_qmlxmlhttprequest::status() -{ - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.200.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("status.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedStatus", 200); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("sentException").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("resetException").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.404.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("status.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedStatus", 404); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("sentException").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("resetException").toBool(), true); - - delete object; - } -} - -void tst_qmlxmlhttprequest::statusText() -{ - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.200.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("statusText.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedStatus", "OK"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("sentException").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("resetException").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.404.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("statusText.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedStatus", "Document not found"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsentException").toBool(), true); - QCOMPARE(object->property("openedException").toBool(), true); - QCOMPARE(object->property("sentException").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("resetException").toBool(), true); - - delete object; - } -} - -void tst_qmlxmlhttprequest::responseText() -{ - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.200.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("responseText.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedText", "QML Rocks!\n"); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsent").toBool(), true); - QCOMPARE(object->property("opened").toBool(), true); - QCOMPARE(object->property("sent").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("reset").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.200.reply"), - QUrl())); - - QmlComponent component(&engine, TEST_FILE("responseText.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedText", ""); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsent").toBool(), true); - QCOMPARE(object->property("opened").toBool(), true); - QCOMPARE(object->property("sent").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("reset").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - QVERIFY(server.wait(TEST_FILE("status.expect"), - TEST_FILE("status.404.reply"), - TEST_FILE("testdocument.html"))); - - QmlComponent component(&engine, TEST_FILE("responseText.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/testdocument.html"); - object->setProperty("expectedText", ""); - component.completeCreate(); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("unsent").toBool(), true); - QCOMPARE(object->property("opened").toBool(), true); - QCOMPARE(object->property("sent").toBool(), true); - QCOMPARE(object->property("headersReceived").toBool(), true); - QCOMPARE(object->property("loading").toBool(), true); - QCOMPARE(object->property("done").toBool(), true); - QCOMPARE(object->property("reset").toBool(), true); - - delete object; - } -} - -// Test that calling hte XMLHttpRequest methods on a non-XMLHttpRequest object -// throws an exception -void tst_qmlxmlhttprequest::invalidMethodUsage() -{ - QmlComponent component(&engine, TEST_FILE("invalidMethodUsage.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - QCOMPARE(object->property("onreadystatechange").toBool(), true); - QCOMPARE(object->property("readyState").toBool(), true); - QCOMPARE(object->property("status").toBool(), true); - QCOMPARE(object->property("statusText").toBool(), true); - QCOMPARE(object->property("responseText").toBool(), true); - QCOMPARE(object->property("responseXML").toBool(), true); - - QCOMPARE(object->property("open").toBool(), true); - QCOMPARE(object->property("setRequestHeader").toBool(), true); - QCOMPARE(object->property("send").toBool(), true); - QCOMPARE(object->property("abort").toBool(), true); - QCOMPARE(object->property("getResponseHeader").toBool(), true); - QCOMPARE(object->property("getAllResponseHeaders").toBool(), true); - - delete object; -} - -// Test that XMLHttpRequest transparently redirects -void tst_qmlxmlhttprequest::redirects() -{ - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirecttarget.html"); - server.serveDirectory("data"); - - QmlComponent component(&engine, TEST_FILE("redirects.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); - object->setProperty("expectedText", ""); - component.completeCreate(); - - TRY_WAIT(object->property("done").toBool() == true); - QCOMPARE(object->property("dataOK").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirectmissing.html"); - server.serveDirectory("data"); - - QmlComponent component(&engine, TEST_FILE("redirectError.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); - object->setProperty("expectedText", ""); - component.completeCreate(); - - TRY_WAIT(object->property("done").toBool() == true); - QCOMPARE(object->property("dataOK").toBool(), true); - - delete object; - } - - { - TestHTTPServer server(SERVER_PORT); - QVERIFY(server.isValid()); - server.addRedirect("redirect.html", "http://127.0.0.1:14445/redirect.html"); - server.serveDirectory("data"); - - QmlComponent component(&engine, TEST_FILE("redirectRecur.qml")); - QObject *object = component.beginCreate(engine.rootContext()); - QVERIFY(object != 0); - object->setProperty("url", "http://127.0.0.1:14445/redirect.html"); - object->setProperty("expectedText", ""); - component.completeCreate(); - - for (int ii = 0; ii < 60; ++ii) { - if (object->property("done").toBool()) break; - QTest::qWait(50); - } - QVERIFY(object->property("done").toBool() == true); - - QCOMPARE(object->property("dataOK").toBool(), true); - - delete object; - } -} - -void tst_qmlxmlhttprequest::responseXML_invalid() -{ - QmlComponent component(&engine, TEST_FILE("responseXML_invalid.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlNull").toBool(), true); - - delete object; -} - -// Test the Document DOM element -void tst_qmlxmlhttprequest::document() -{ - QmlComponent component(&engine, TEST_FILE("document.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlTest").toBool(), true); - - delete object; -} - -// Test the Element DOM element -void tst_qmlxmlhttprequest::element() -{ - QmlComponent component(&engine, TEST_FILE("element.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlTest").toBool(), true); - - delete object; -} - -// Test the Attr DOM element -void tst_qmlxmlhttprequest::attr() -{ - QmlComponent component(&engine, TEST_FILE("attr.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlTest").toBool(), true); - - delete object; -} - -// Test the Text DOM element -void tst_qmlxmlhttprequest::text() -{ - QmlComponent component(&engine, TEST_FILE("text.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlTest").toBool(), true); - - delete object; -} - -// Test the CDataSection DOM element -void tst_qmlxmlhttprequest::cdata() -{ - QmlComponent component(&engine, TEST_FILE("cdata.qml")); - QObject *object = component.create(); - QVERIFY(object != 0); - - TRY_WAIT(object->property("dataOK").toBool() == true); - - QCOMPARE(object->property("xmlTest").toBool(), true); - - delete object; -} - -QTEST_MAIN(tst_qmlxmlhttprequest) - -#include "tst_qmlxmlhttprequest.moc" diff --git a/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro b/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro deleted file mode 100644 index 8e58a32..0000000 --- a/tests/auto/declarative/qmlxmllistmodel/qmlxmllistmodel.pro +++ /dev/null @@ -1,11 +0,0 @@ -load(qttest_p4) -contains(QT_CONFIG,declarative): QT += declarative gui -contains(QT_CONFIG,xmlpatterns) { - QT += xmlpatterns - DEFINES += QTEST_XMLPATTERNS -} -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlxmllistmodel.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" diff --git a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp b/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp deleted file mode 100644 index df1931f..0000000 --- a/tests/auto/declarative/qmlxmllistmodel/tst_qmlxmllistmodel.cpp +++ /dev/null @@ -1,203 +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 <qtest.h> - -#ifdef QTEST_XMLPATTERNS -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlxmllistmodel_p.h> -#include "../../../shared/util.h" - -class tst_qmlxmllistmodel : public QObject - -{ - Q_OBJECT -public: - tst_qmlxmllistmodel() {} - -private slots: - void buildModel(); - void missingFields(); - void cdata(); - void attributes(); - void roles(); - void roleErrors(); - void uniqueRoleNames(); - -private: - QmlEngine engine; -}; - -void tst_qmlxmllistmodel::buildModel() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); - - QList<int> roles; - roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; - QHash<int, QVariant> data = listModel->data(3, roles); - QVERIFY(data.count() == 4); - QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Spot")); - QCOMPARE(data.value(Qt::UserRole+1).toString(), QLatin1String("Dog")); - QCOMPARE(data.value(Qt::UserRole+2).toInt(), 9); - QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("Medium")); - - delete listModel; -} - -void tst_qmlxmllistmodel::missingFields() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model2.qml")); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); - - QList<int> roles; - roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3 << Qt::UserRole + 4; - QHash<int, QVariant> data = listModel->data(5, roles); - QVERIFY(data.count() == 5); - QCOMPARE(data.value(Qt::UserRole+3).toString(), QLatin1String("")); - QCOMPARE(data.value(Qt::UserRole+4).toString(), QLatin1String("")); - - data = listModel->data(7, roles); - QVERIFY(data.count() == 5); - QCOMPARE(data.value(Qt::UserRole+2).toString(), QLatin1String("")); - - delete listModel; -} - -void tst_qmlxmllistmodel::cdata() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 5); - - QList<int> roles; - roles << Qt::UserRole + 2; - QHash<int, QVariant> data = listModel->data(2, roles); - QVERIFY(data.count() == 1); - QVERIFY(data.value(Qt::UserRole+2).toString().startsWith(QLatin1String("<html>"))); - - delete listModel; -} - -void tst_qmlxmllistmodel::attributes() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/recipes.qml")); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 5); - - QList<int> roles; - roles << Qt::UserRole; - QHash<int, QVariant> data = listModel->data(2, roles); - QVERIFY(data.count() == 1); - QCOMPARE(data.value(Qt::UserRole).toString(), QLatin1String("Vegetable Soup")); - - delete listModel; -} - -void tst_qmlxmllistmodel::roles() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/model.qml")); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); - - QList<int> roles = listModel->roles(); - QCOMPARE(roles.count(), 4); - QCOMPARE(listModel->toString(roles.at(0)), QLatin1String("name")); - QCOMPARE(listModel->toString(roles.at(1)), QLatin1String("type")); - QCOMPARE(listModel->toString(roles.at(2)), QLatin1String("age")); - QCOMPARE(listModel->toString(roles.at(3)), QLatin1String("size")); - - delete listModel; -} - -void tst_qmlxmllistmodel::roleErrors() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml")); - QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/roleErrors.qml").toString() + ":6:5) An XmlRole query must not start with '/'").toUtf8().constData()); - //### make sure we receive all expected warning messages. - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); - - QList<int> roles; - roles << Qt::UserRole << Qt::UserRole + 1 << Qt::UserRole + 2 << Qt::UserRole + 3; - QHash<int, QVariant> data = listModel->data(3, roles); - QVERIFY(data.count() == 4); - - //### should any of these return valid values? - QCOMPARE(data.value(Qt::UserRole), QVariant()); - QCOMPARE(data.value(Qt::UserRole+1), QVariant()); - QCOMPARE(data.value(Qt::UserRole+2), QVariant()); - - QEXPECT_FAIL("", "QT-2456", Continue); - QCOMPARE(data.value(Qt::UserRole+3), QVariant()); - - delete listModel; -} - -void tst_qmlxmllistmodel::uniqueRoleNames() -{ - QmlComponent component(&engine, QUrl::fromLocalFile(SRCDIR "/data/unique.qml")); - QTest::ignoreMessage(QtWarningMsg, QString("QML XmlRole (" + QUrl::fromLocalFile(SRCDIR "/data/unique.qml").toString() + ":7:5) \"name\" duplicates a previous role name and will be disabled.").toUtf8().constData()); - QmlXmlListModel *listModel = qobject_cast<QmlXmlListModel*>(component.create()); - QVERIFY(listModel != 0); - QTRY_COMPARE(listModel->count(), 9); - - QList<int> roles = listModel->roles(); - QCOMPARE(roles.count(), 1); - - delete listModel; -} - -QTEST_MAIN(tst_qmlxmllistmodel) - -#include "tst_qmlxmllistmodel.moc" - -#else -QTEST_NOOP_MAIN -#endif diff --git a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp index 45947e3..2621d65 100644 --- a/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp +++ b/tests/auto/declarative/qpacketprotocol/tst_qpacketprotocol.cpp @@ -117,7 +117,7 @@ void tst_QPacketProtocol::setMaximumPacketSize() QByteArray b; b.fill('a', size + 1); out.send() << b.constData(); - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(invalidPacket()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(invalidPacket()))); } } @@ -149,7 +149,7 @@ void tst_QPacketProtocol::send() out.send(packet); } - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); QPacket p = in.read(); p >> ba >> num; @@ -178,7 +178,7 @@ void tst_QPacketProtocol::packetsAvailable() for (int i=0; i<packetCount; i++) out.send() << "Hello"; - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); QCOMPARE(in.packetsAvailable(), qint64(packetCount)); } @@ -198,7 +198,7 @@ void tst_QPacketProtocol::clear() out.send() << 123; out.send() << 456; - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); in.clear(); QVERIFY(in.read().isEmpty()); @@ -213,7 +213,7 @@ void tst_QPacketProtocol::read() out.send() << 123; out.send() << 456; - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); int num; @@ -253,7 +253,7 @@ void tst_QPacketProtocol::tst_QPacket_clear() QByteArray ba; int num; QPacketProtocol in(m_serverConn); - QVERIFY(QmlDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); + QVERIFY(QDeclarativeDebugTest::waitForSignal(&in, SIGNAL(readyRead()))); QPacket p1 = in.read(); p1 >> ba >> num; diff --git a/tests/auto/declarative/shared/debugutil.cpp b/tests/auto/declarative/shared/debugutil.cpp index 864bb63..66f04e5 100644 --- a/tests/auto/declarative/shared/debugutil.cpp +++ b/tests/auto/declarative/shared/debugutil.cpp @@ -42,14 +42,14 @@ #include <QEventLoop> #include <QTimer> -#include <private/qmldebugclient_p.h> -#include <private/qmldebugservice_p.h> +#include <private/qdeclarativedebugclient_p.h> +#include <private/qdeclarativedebugservice_p.h> #include "debugutil_p.h" #include <iostream> -bool QmlDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) { +bool QDeclarativeDebugTest::waitForSignal(QObject *receiver, const char *member, int timeout) { QEventLoop loop; QTimer timer; QObject::connect(&timer, SIGNAL(timeout()), &loop, SLOT(quit())); @@ -60,17 +60,17 @@ bool QmlDebugTest::waitForSignal(QObject *receiver, const char *member, int time } -QmlDebugTestData::QmlDebugTestData(QEventLoop *el) +QDeclarativeDebugTestData::QDeclarativeDebugTestData(QEventLoop *el) : exitCode(-1), loop(el) { } -QmlDebugTestData::~QmlDebugTestData() +QDeclarativeDebugTestData::~QDeclarativeDebugTestData() { qDeleteAll(items); } -void QmlDebugTestData::testsFinished(int code) +void QDeclarativeDebugTestData::testsFinished(int code) { exitCode = code; loop->quit(); @@ -78,56 +78,56 @@ void QmlDebugTestData::testsFinished(int code) -QmlDebugTestService::QmlDebugTestService(const QString &s, QObject *parent) - : QmlDebugService(s, parent), enabled(false) +QDeclarativeDebugTestService::QDeclarativeDebugTestService(const QString &s, QObject *parent) + : QDeclarativeDebugService(s, parent), enabled(false) { } -void QmlDebugTestService::messageReceived(const QByteArray &ba) +void QDeclarativeDebugTestService::messageReceived(const QByteArray &ba) { sendMessage(ba); } -void QmlDebugTestService::enabledChanged(bool e) +void QDeclarativeDebugTestService::enabledChanged(bool e) { enabled = e; emit enabledStateChanged(); } -QmlDebugTestClient::QmlDebugTestClient(const QString &s, QmlDebugConnection *c) - : QmlDebugClient(s, c) +QDeclarativeDebugTestClient::QDeclarativeDebugTestClient(const QString &s, QDeclarativeDebugConnection *c) + : QDeclarativeDebugClient(s, c) { } -QByteArray QmlDebugTestClient::waitForResponse() +QByteArray QDeclarativeDebugTestClient::waitForResponse() { lastMsg.clear(); - QmlDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray))); + QDeclarativeDebugTest::waitForSignal(this, SIGNAL(serverMessage(QByteArray))); if (lastMsg.isEmpty()) { - qWarning() << "tst_QmlDebugClient: no response from server!"; + qWarning() << "tst_QDeclarativeDebugClient: no response from server!"; return QByteArray(); } return lastMsg; } -void QmlDebugTestClient::messageReceived(const QByteArray &ba) +void QDeclarativeDebugTestClient::messageReceived(const QByteArray &ba) { lastMsg = ba; emit serverMessage(ba); } -tst_QmlDebug_Thread::tst_QmlDebug_Thread(QmlDebugTestData *data, QmlTestFactory *factory) +tst_QDeclarativeDebug_Thread::tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory) : m_data(data), m_factory(factory) { } -void tst_QmlDebug_Thread::run() +void tst_QDeclarativeDebug_Thread::run() { bool ok = false; - QmlDebugConnection conn; + QDeclarativeDebugConnection conn; conn.connectToHost("127.0.0.1", 3768); ok = conn.waitForConnected(); Q_ASSERT(ok); @@ -146,25 +146,25 @@ void tst_QmlDebug_Thread::run() emit testsFinished(code); } -int QmlDebugTest::runTests(QmlTestFactory *factory, const QList<QByteArray> &qml) +int QDeclarativeDebugTest::runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml) { qputenv("QML_DEBUG_SERVER_PORT", "3768"); QEventLoop loop; - QmlDebugTestData data(&loop); + QDeclarativeDebugTestData data(&loop); - tst_QmlDebug_Thread thread(&data, factory); + tst_QDeclarativeDebug_Thread thread(&data, factory); QObject::connect(&thread, SIGNAL(testsFinished(int)), &data, SLOT(testsFinished(int))); - QmlDebugService::notifyOnServerStart(&thread, "start"); + QDeclarativeDebugService::notifyOnServerStart(&thread, "start"); - QmlEngine engine; // blocks until client connects + QDeclarativeEngine engine; // blocks until client connects foreach (const QByteArray &code, qml) { - QmlComponent c(&engine); + QDeclarativeComponent c(&engine); c.setData(code, QUrl::fromLocalFile("")); Q_ASSERT(c.isReady()); // fails if bad syntax - data.items << qobject_cast<QmlGraphicsItem*>(c.create()); + data.items << qobject_cast<QDeclarativeItem*>(c.create()); } // start the test diff --git a/tests/auto/declarative/shared/debugutil_p.h b/tests/auto/declarative/shared/debugutil_p.h index 6815b3c..c152b5a 100644 --- a/tests/auto/declarative/shared/debugutil_p.h +++ b/tests/auto/declarative/shared/debugutil_p.h @@ -45,37 +45,37 @@ #include <QThread> #include <QTest> -#include <QtDeclarative/qmlengine.h> +#include <QtDeclarative/qdeclarativeengine.h> -#include <private/qmldebugclient_p.h> -#include <private/qmldebugservice_p.h> -#include <private/qmlgraphicsitem_p.h> +#include <private/qdeclarativedebugclient_p.h> +#include <private/qdeclarativedebugservice_p.h> +#include <private/qdeclarativeitem_p.h> -class QmlTestFactory; +class QDeclarativeTestFactory; -class QmlDebugTest +class QDeclarativeDebugTest { public: static bool waitForSignal(QObject *receiver, const char *member, int timeout = 5000); - static int runTests(QmlTestFactory *factory, const QList<QByteArray> &qml = QList<QByteArray>()); + static int runTests(QDeclarativeTestFactory *factory, const QList<QByteArray> &qml = QList<QByteArray>()); }; -class QmlDebugTestData : public QObject +class QDeclarativeDebugTestData : public QObject { Q_OBJECT public: - QmlDebugTestData(QEventLoop *el); + QDeclarativeDebugTestData(QEventLoop *el); - ~QmlDebugTestData(); + ~QDeclarativeDebugTestData(); - QmlDebugConnection *conn; - QmlEngine *engine; + QDeclarativeDebugConnection *conn; + QDeclarativeEngine *engine; int exitCode; QEventLoop *loop; - QList<QmlGraphicsItem *> items; + QList<QDeclarativeItem *> items; signals: void engineCreated(); @@ -84,24 +84,24 @@ public slots: void testsFinished(int code); private: - friend class QmlDebugTest; + friend class QDeclarativeDebugTest; }; -class QmlTestFactory +class QDeclarativeTestFactory { public: - QmlTestFactory() {} - virtual ~QmlTestFactory() {} + QDeclarativeTestFactory() {} + virtual ~QDeclarativeTestFactory() {} - virtual QObject *createTest(QmlDebugTestData *data) = 0; + virtual QObject *createTest(QDeclarativeDebugTestData *data) = 0; }; -class QmlDebugTestService : public QmlDebugService +class QDeclarativeDebugTestService : public QDeclarativeDebugService { Q_OBJECT public: - QmlDebugTestService(const QString &s, QObject *parent = 0); + QDeclarativeDebugTestService(const QString &s, QObject *parent = 0); bool enabled; signals: @@ -113,11 +113,11 @@ protected: virtual void enabledChanged(bool e); }; -class QmlDebugTestClient : public QmlDebugClient +class QDeclarativeDebugTestClient : public QDeclarativeDebugClient { Q_OBJECT public: - QmlDebugTestClient(const QString &s, QmlDebugConnection *c); + QDeclarativeDebugTestClient(const QString &s, QDeclarativeDebugConnection *c); QByteArray waitForResponse(); @@ -131,11 +131,11 @@ private: QByteArray lastMsg; }; -class tst_QmlDebug_Thread : public QThread +class tst_QDeclarativeDebug_Thread : public QThread { Q_OBJECT public: - tst_QmlDebug_Thread(QmlDebugTestData *data, QmlTestFactory *factory); + tst_QDeclarativeDebug_Thread(QDeclarativeDebugTestData *data, QDeclarativeTestFactory *factory); void run(); @@ -143,8 +143,8 @@ signals: void testsFinished(int); private: - QmlDebugTestData *m_data; - QmlTestFactory *m_factory; + QDeclarativeDebugTestData *m_data; + QDeclarativeTestFactory *m_factory; }; diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp index 2384101..e8a5e0c 100644 --- a/tests/auto/declarative/sql/tst_sql.cpp +++ b/tests/auto/declarative/sql/tst_sql.cpp @@ -40,10 +40,10 @@ ****************************************************************************/ #include <qtest.h> #include "../../../shared/util.h" -#include <QtDeclarative/qmlengine.h> -#include <QtDeclarative/qmlcomponent.h> -#include <private/qmlgraphicstext_p.h> -#include <private/qmlengine_p.h> +#include <QtDeclarative/qdeclarativeengine.h> +#include <QtDeclarative/qdeclarativecomponent.h> +#include <private/qdeclarativetext_p.h> +#include <private/qdeclarativeengine_p.h> #include <QtCore/qcryptographichash.h> #include <QtWebKit/qwebpage.h> #include <QtWebKit/qwebframe.h> @@ -62,7 +62,7 @@ public: qApp->setApplicationName("tst_sql"); qApp->setOrganizationName("Nokia"); qApp->setOrganizationDomain("nokia.com"); - engine = new QmlEngine; + engine = new QDeclarativeEngine; } ~tst_sql() @@ -85,7 +85,7 @@ private slots: private: QString dbDir() const; - QmlEngine *engine; + QDeclarativeEngine *engine; }; class QWebPageWithJavaScriptConsoleMessages : public QWebPage { @@ -200,9 +200,9 @@ void tst_sql::testQml() "Text { Script { source: \""+jsfile+"\" } text: test() }"; engine->setOfflineStoragePath(dbDir()); - QmlComponent component(engine); + QDeclarativeComponent component(engine); component.setData(qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports - QmlGraphicsText *text = qobject_cast<QmlGraphicsText*>(component.create()); + QDeclarativeText *text = qobject_cast<QDeclarativeText*>(component.create()); QVERIFY(text != 0); QCOMPARE(text->text(),QString("passed")); } @@ -221,7 +221,7 @@ void tst_sql::testQml_cleanopen() // making it more like the tests are running in new processes. testQml(); - QmlEnginePrivate::getScriptEngine(engine)->collectGarbage(); // close databases + QDeclarativeEnginePrivate::getScriptEngine(engine)->collectGarbage(); // close databases foreach (QString dbname, QSqlDatabase::connectionNames()) { QSqlDatabase::removeDatabase(dbname); } diff --git a/tests/auto/declarative/visual/Package_Views/packageviews.qml b/tests/auto/declarative/visual/Package_Views/packageviews.qml index b577e45..cf3f9f7 100644 --- a/tests/auto/declarative/visual/Package_Views/packageviews.qml +++ b/tests/auto/declarative/visual/Package_Views/packageviews.qml @@ -64,7 +64,7 @@ Rectangle { from: "*"; to: "*" SequentialAnimation { ParentAction{} - NumberAnimation { properties: "x,y,width"; easing: "easeInOutQuad" } + NumberAnimation { properties: "x,y,width"; easing.type: "InOutQuad" } } } ] diff --git a/tests/auto/declarative/visual/animation/easing/easing.qml b/tests/auto/declarative/visual/animation/easing/easing.qml index 9c814eb..4248d88 100644 --- a/tests/auto/declarative/visual/animation/easing/easing.qml +++ b/tests/auto/declarative/visual/animation/easing/easing.qml @@ -9,127 +9,127 @@ Rectangle { ListModel { id: easingtypes ListElement { - type: "easeLinear" + type: "Linear" } ListElement { - type: "easeInQuad" + type: "InQuad" } ListElement { - type: "easeOutQuad" + type: "OutQuad" } ListElement { - type: "easeInOutQuad" + type: "InOutQuad" } ListElement { - type: "easeOutInQuad" + type: "OutInQuad" } ListElement { - type: "easeInCubic" + type: "InCubic" } ListElement { - type: "easeOutCubic" + type: "OutCubic" } ListElement { - type: "easeInOutCubic" + type: "InOutCubic" } ListElement { - type: "easeOutInCubic" + type: "OutInCubic" } ListElement { - type: "easeInQuart" + type: "InQuart" } ListElement { - type: "easeOutQuart" + type: "OutQuart" } ListElement { - type: "easeInOutQuart" + type: "InOutQuart" } ListElement { - type: "easeOutInQuart" + type: "OutInQuart" } ListElement { - type: "easeInQuint" + type: "InQuint" } ListElement { - type: "easeOutQuint" + type: "OutQuint" } ListElement { - type: "easeInOutQuint" + type: "InOutQuint" } ListElement { - type: "easeOutInQuint" + type: "OutInQuint" } ListElement { - type: "easeInSine" + type: "InSine" } ListElement { - type: "easeOutSine" + type: "OutSine" } ListElement { - type: "easeInOutSine" + type: "InOutSine" } ListElement { - type: "easeOutInSine" + type: "OutInSine" } ListElement { - type: "easeInExpo" + type: "InExpo" } ListElement { - type: "easeOutExpo" + type: "OutExpo" } ListElement { - type: "easeInOutExpo" + type: "InOutExpo" } ListElement { - type: "easeOutInExpo" + type: "OutInExpo" } ListElement { - type: "easeInCirc" + type: "InCirc" } ListElement { - type: "easeOutCirc" + type: "OutCirc" } ListElement { - type: "easeInOutCirc" + type: "InOutCirc" } ListElement { - type: "easeOutInCirc" + type: "OutInCirc" } ListElement { - type: "easeInElastic" + type: "InElastic" } ListElement { - type: "easeOutElastic" + type: "OutElastic" } ListElement { - type: "easeInOutElastic" + type: "InOutElastic" } ListElement { - type: "easeOutInElastic" + type: "OutInElastic" } ListElement { - type: "easeInBack" + type: "InBack" } ListElement { - type: "easeOutBack" + type: "OutBack" } ListElement { - type: "easeInOutBack" + type: "InOutBack" } ListElement { - type: "easeOutInBack" + type: "OutInBack" } ListElement { - type: "easeOutBounce" + type: "OutBounce" } ListElement { - type: "easeInBounce" + type: "InBounce" } ListElement { - type: "easeInOutBounce" + type: "InOutBounce" } ListElement { - type: "easeOutInBounce" + type: "OutInBounce" } } ] @@ -177,7 +177,7 @@ Rectangle { reversible: true NumberAnimation { properties: "x" - easing: type + easing.type: type duration: 1000 } } diff --git a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml index f2e065d..24ca76b 100644 --- a/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml +++ b/tests/auto/declarative/visual/animation/pauseAnimation/pauseAnimation.qml @@ -14,11 +14,11 @@ Rectangle { repeat: true NumberAnimation { to: 0; duration: 500 - easing: "easeInOutQuad" + easing.type: "InOutQuad" } NumberAnimation { to: 200-img.height - easing: "easeOutBounce" + easing.type: "OutBounce" duration: 2000 } PauseAnimation { diff --git a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml index 593f495..e18e770 100644 --- a/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml +++ b/tests/auto/declarative/visual/animation/propertyAction/propertyAction.qml @@ -28,7 +28,7 @@ Rectangle { SequentialAnimation { ColorAnimation {} PropertyAction { properties: "x" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml index 30d587a..ef4ed76 100644 --- a/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml +++ b/tests/auto/declarative/visual/animation/scriptAction/scriptAction.qml @@ -27,9 +27,9 @@ Rectangle { transitions: Transition { SequentialAnimation { - NumberAnimation { properties: "x"; easing: "InOutQuad" } + NumberAnimation { properties: "x"; easing.type: "InOutQuad" } ScriptAction { stateChangeScriptName: "setColor" } - NumberAnimation { properties: "y"; easing: "InOutQuad" } + NumberAnimation { properties: "y"; easing.type: "InOutQuad" } } } } diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/animated-smooth.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/animated-smooth.qml index 0ceaf49..0ceaf49 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/animated-smooth.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/animated-smooth.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/animated.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/animated.qml index 29c02b3..29c02b3 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/animated.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/animated.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/borders.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/borders.qml index 9879416..9879416 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/borders.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/borders.qml diff --git a/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml new file mode 100644 index 0000000..e268ce7 --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/MyBorderImage.qml @@ -0,0 +1,38 @@ +import Qt 4.6 + +Item { + property alias horizontalMode: image.horizontalTileMode + property alias verticalMode: image.verticalTileMode + property alias source: image.source + property alias antialiased: image.smooth + + property int minWidth + property int minHeight + property int maxWidth + property int maxHeight + property int margin + + id: container + width: 240; height: 240 + + BorderImage { + id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 + + width: SequentialAnimation { + repeat: true + NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing.type: "InOutQuad" } + } + + height: SequentialAnimation { + repeat: true + NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing.type: "InOutQuad"} + NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing.type: "InOutQuad" } + } + + border.top: container.margin + border.left: container.margin + border.bottom: container.margin + border.right: container.margin + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/bw.png b/tests/auto/declarative/visual/qdeclarativeborderimage/content/bw.png Binary files differindex 486eaae..486eaae 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/bw.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/bw.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-round.sci b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-round.sci index 506f6f5..506f6f5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-round.sci +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-round.sci diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-stretch.sci b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-stretch.sci index e4989a7..e4989a7 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/colors-stretch.sci +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors-stretch.sci diff --git a/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors.png b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors.png Binary files differnew file mode 100644 index 0000000..dfb62f3 --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/content/colors.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.0.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.0.png Binary files differindex 9a6b079..9a6b079 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.0.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.1.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.1.png Binary files differindex 1f960e5..1f960e5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.1.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.2.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.2.png Binary files differindex 85a2729..85a2729 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.2.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.3.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.3.png Binary files differindex de6ff7c..de6ff7c 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.3.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.4.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.4.png Binary files differindex fe7d3dd..fe7d3dd 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.4.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.5.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.5.png Binary files differindex e73bef5..e73bef5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.5.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.6.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.6.png Binary files differindex 0c75422..0c75422 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.6.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.qml index 043f5e2..043f5e2 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated-smooth.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated-smooth.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.0.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.0.png Binary files differindex 99228f9..99228f9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.0.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.1.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.1.png Binary files differindex a2dcd00..a2dcd00 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.1.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.2.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.2.png Binary files differindex 8a80020..8a80020 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.2.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.3.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.3.png Binary files differindex 02b57ef..02b57ef 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.3.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.4.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.4.png Binary files differindex df0f6cc..df0f6cc 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.4.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.5.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.5.png Binary files differindex 0add64d..0add64d 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.5.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.6.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.6.png Binary files differindex 0886207..0886207 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.6.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.7.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.7.png Binary files differindex bc1a7b0..bc1a7b0 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.7.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.qml index 29e591a..29e591a 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/animated.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/animated.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.0.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.0.png Binary files differindex 80cbd26..80cbd26 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.0.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.1.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.1.png Binary files differindex 80cbd26..80cbd26 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.1.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.2.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.2.png Binary files differindex 80cbd26..80cbd26 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.2.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.3.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.3.png Binary files differindex 80cbd26..80cbd26 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.3.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.4.png b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.4.png Binary files differindex 80cbd26..80cbd26 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.4.png +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.qml b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.qml index 16cd5e9..16cd5e9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/data/borders.qml +++ b/tests/auto/declarative/visual/qdeclarativeborderimage/data/borders.qml diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.0.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.0.png Binary files differindex 21b6afb..21b6afb 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.0.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.0.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.1.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.1.png Binary files differindex bb8a02b..bb8a02b 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.1.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.1.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.2.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.2.png Binary files differindex da60237..da60237 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.2.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.2.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.3.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.3.png Binary files differindex 3e943e8..3e943e8 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.3.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.3.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.4.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.4.png Binary files differindex 4fbaf26..4fbaf26 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.4.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.4.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.5.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.5.png Binary files differindex c10d196..c10d196 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.5.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.5.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.6.png b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.6.png Binary files differindex a672c06..a672c06 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.6.png +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.6.png diff --git a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.qml b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.qml index 029a2fc..029a2fc 100644 --- a/tests/auto/declarative/visual/qmleasefollow/data/easefollow.qml +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/data/easefollow.qml diff --git a/tests/auto/declarative/visual/qmleasefollow/easefollow.qml b/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml index bd3270f..bd3270f 100644 --- a/tests/auto/declarative/visual/qmleasefollow/easefollow.qml +++ b/tests/auto/declarative/visual/qdeclarativeeasefollow/easefollow.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.0.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.0.png Binary files differindex 016902b..016902b 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.0.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.1.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.1.png Binary files differindex a654936..a654936 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.1.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.2.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.2.png Binary files differindex cfd5517..cfd5517 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.2.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.3.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.3.png Binary files differindex 016902b..016902b 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.3.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.qml b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.qml index 46086f9..46086f9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-horizontal.qml +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-horizontal.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.0.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.0.png Binary files differindex 18fef53..18fef53 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.0.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.1.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.1.png Binary files differindex 18fef53..18fef53 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.1.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.10.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.10.png Binary files differindex b352c68..b352c68 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.10.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.10.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.11.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.11.png Binary files differindex ce7ee68..ce7ee68 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.11.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.11.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.12.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.12.png Binary files differindex d8cdacf..d8cdacf 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.12.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.12.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.13.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.13.png Binary files differindex 0c2fa7b..0c2fa7b 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.13.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.13.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.14.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.14.png Binary files differindex e9b3028..e9b3028 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.14.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.14.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.15.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.15.png Binary files differindex 2186a8b..2186a8b 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.15.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.15.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.16.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.16.png Binary files differindex b4590af..b4590af 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.16.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.16.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.17.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.17.png Binary files differindex fe29f19..fe29f19 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.17.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.17.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.18.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.18.png Binary files differindex fe29f19..fe29f19 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.18.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.18.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.19.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.19.png Binary files differindex 4f8587f..4f8587f 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.19.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.19.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.2.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.2.png Binary files differindex 0a7cc03..0a7cc03 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.2.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.20.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.20.png Binary files differindex 4f8587f..4f8587f 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.20.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.20.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.21.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.21.png Binary files differindex c0b0bdf..c0b0bdf 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.21.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.21.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.22.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.22.png Binary files differindex 4168c3b..4168c3b 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.22.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.22.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.23.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.23.png Binary files differindex 18fef53..18fef53 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.23.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.23.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.24.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.24.png index e69de29..e69de29 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.24.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.24.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.3.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.3.png Binary files differindex fc6669d..fc6669d 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.3.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.4.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.4.png Binary files differindex c0b0bdf..c0b0bdf 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.4.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.5.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.5.png Binary files differindex 2ffa96e..2ffa96e 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.5.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.6.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.6.png Binary files differindex f550b89..f550b89 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.6.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.7.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.7.png Binary files differindex f550b89..f550b89 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.7.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.8.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.8.png Binary files differindex f550b89..f550b89 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.8.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.9.png b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.9.png Binary files differindex f550b89..f550b89 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.9.png +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.9.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.qml index db70298..db70298 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/data/flickable-vertical.qml +++ b/tests/auto/declarative/visual/qdeclarativeflickable/data/flickable-vertical.qml diff --git a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml new file mode 100644 index 0000000..50ba9ad --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-horizontal.qml @@ -0,0 +1,37 @@ +import Qt 4.6 + +Rectangle { + color: "lightSteelBlue" + width: 600; height: 300 + + ListModel { + id: list + ListElement { dayColor: "steelblue" } + ListElement { dayColor: "blue" } + ListElement { dayColor: "yellow" } + ListElement { dayColor: "purple" } + ListElement { dayColor: "red" } + ListElement { dayColor: "green" } + ListElement { dayColor: "orange" } + } + + Flickable { + id: flickable + anchors.fill: parent; contentWidth: row.width + + Row { + id: row + Repeater { + model: list + Rectangle { width: 200; height: 300; color: dayColor } + } + } + } + Rectangle { + radius: 3 + y: flickable.height-8 + height: 8 + x: flickable.visibleArea.xPosition * flickable.width + width: flickable.visibleArea.widthRatio * flickable.width + } +} diff --git a/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml new file mode 100644 index 0000000..ebb963d --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativeflickable/flickable-vertical.qml @@ -0,0 +1,91 @@ +import Qt 4.6 + +Rectangle { + color: "lightSteelBlue" + width: 300; height: 600 + + ListModel { + id: list + ListElement { dayColor: "steelblue" } + ListElement { dayColor: "blue" } + ListElement { dayColor: "yellow" } + ListElement { dayColor: "purple" } + ListElement { dayColor: "red" } + ListElement { dayColor: "green" } + ListElement { dayColor: "orange" } + } + + flickable { + id: flick + height: parent.height-50 + width: parent.width; contentHeight: column.height + + Column { + id: column + Repeater { + model: list + Rectangle { width: 300; height: 200; color: mr.pressed ? "black" : dayColor + MouseArea { + id: mr + anchors.fill: parent + } + } + } + } + clip: true + reportedVelocitySmoothing: 1000 + } + Rectangle { + radius: 3 + x: flick.width-8 + width: 8 + y: flick.visibleArea.yPosition * flick.height + height: flick.visibleArea.heightRatio * flick.height + } + + // click to toggle interactive flag + Rectangle { + width: 64 + height: 48 + y: parent.height - 50 + color: "red" + MouseArea { + anchors.fill: parent + onClicked: flick.interactive = flick.interactive ? false : true + } + } + + // click to toggle click delay + Rectangle { + width: 64 + height: 48 + x: 66 + y: parent.height - 50 + color: "green" + MouseArea { + anchors.fill: parent + onClicked: flick.pressDelay = flick.pressDelay > 0 ? 0 : 500 + } + } + + // click to toggle overshoot + Rectangle { + width: 64 + height: 48 + x: 130 + y: parent.height - 50 + color: "yellow" + MouseArea { + anchors.fill: parent + onClicked: flick.overShoot = flick.overShoot > 0 ? 0 : 30 + } + } + + Rectangle { + width: Math.abs(flick.verticalVelocity)/100 + height: 50 + x: 200 + y: parent.height - 50 + color: blue + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.0.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.0.png Binary files differindex 53a8b42..53a8b42 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.0.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.1.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.1.png Binary files differindex b7efe8c..b7efe8c 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.1.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.2.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.2.png Binary files differindex aa6d147..aa6d147 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.2.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.3.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.3.png Binary files differindex 9d39713..9d39713 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.3.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.4.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.4.png Binary files differindex 98e8817..98e8817 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.4.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.5.png b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.5.png Binary files differindex a3f9d8f..a3f9d8f 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.5.png +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.qml b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.qml index 520d9a2..520d9a2 100644 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/data/test-flipable.qml +++ b/tests/auto/declarative/visual/qdeclarativeflipable/data/test-flipable.qml diff --git a/tests/auto/declarative/visual/qdeclarativeflipable/test-flipable.qml b/tests/auto/declarative/visual/qdeclarativeflipable/test-flipable.qml new file mode 100644 index 0000000..a27aa6e --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativeflipable/test-flipable.qml @@ -0,0 +1,79 @@ +import Qt 4.6 + +Rectangle { + width: 400; height: 240 + color: "white" + + Timer { + interval: 3000; running: true; repeat: true; triggeredOnStart: true + onTriggered: { + if (flipable.state == '') flipable.state = 'back'; else flipable.state = '' + if (flipable2.state == '') flipable2.state = 'back'; else flipable2.state = '' + } + } + + Flipable { + id: flipable + width: 200; height: 200 + + transform: Rotation { + id: rotation; angle: 0 + origin.x: 100; origin.y: 100 + axis.x: 0; axis.y: 1; axis.z: 0 + } + + front: Rectangle { + color: "steelblue"; width: 200; height: 200 + } + + back: Rectangle { + color: "deeppink"; width: 200; height: 200 + } + + states: State { + name: "back" + PropertyChanges { target: rotation; angle: 180 } + } + + transitions: Transition { + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } + } + } + + Flipable { + id: flipable2 + x: 200; width: 200; height: 200 + + transform: Rotation { + id: rotation2; angle: 0 + origin.x: 100; origin.y: 100 + axis.x: 1; axis.z: 0 + } + + front: Rectangle { + color: "deeppink"; width: 200; height: 200 + } + + back: Rectangle { + color: "steelblue"; width: 200; height: 200 + } + + states: State { + name: "back" + PropertyChanges { target: rotation2; angle: 180 } + } + + transitions: Transition { + NumberAnimation { easing.type: "InOutQuad"; properties: "angle"; duration: 3000 } + } + } + + Rectangle { + x: 25; width: 150; y: 210; height: 20; color: "black" + visible: flipable.side == Flipable.Front + } + Rectangle { + x: 225; width: 150; y: 210; height: 20; color: "black" + visible: flipable2.side == Flipable.Back + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.0.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.0.png Binary files differindex 6c82777..6c82777 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.0.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.1.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.1.png Binary files differindex 07b1f7c..07b1f7c 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.1.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.2.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.2.png Binary files differindex f2f08c0..f2f08c0 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.2.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.3.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.3.png Binary files differindex 08649f9..08649f9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.3.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.4.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.4.png Binary files differindex f9c2f17..f9c2f17 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.4.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.5.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.5.png Binary files differindex 52ec0bd..52ec0bd 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.5.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.6.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.6.png Binary files differindex 3fe25be..3fe25be 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.6.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.7.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.7.png Binary files differindex 4cc12a6..4cc12a6 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.7.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.8.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.8.png Binary files differindex 2267f23..2267f23 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.8.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.9.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.9.png Binary files differindex 6c82777..6c82777 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.9.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.9.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.qml b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.qml index c7ac52d..c7ac52d 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview.qml +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.0.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.0.png Binary files differindex 3021d58..3021d58 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.0.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.1.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.1.png Binary files differindex baeb1a6..baeb1a6 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.1.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.10.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.10.png Binary files differindex b0486e5..b0486e5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.10.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.10.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.2.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.2.png Binary files differindex 2d0c731..2d0c731 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.2.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.3.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.3.png Binary files differindex af9ed05..af9ed05 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.3.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.4.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.4.png Binary files differindex 0b0945d..0b0945d 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.4.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.5.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.5.png Binary files differindex 618ae0c..618ae0c 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.5.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.6.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.6.png Binary files differindex fc31262..fc31262 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.6.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.7.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.7.png Binary files differindex 22291ac..22291ac 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.7.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.8.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.8.png Binary files differindex 3021d58..3021d58 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.8.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.9.png b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.9.png Binary files differindex 2f2f5b9..2f2f5b9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.9.png +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.9.png diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.qml b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.qml index fb5f1fb..fb5f1fb 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/data/gridview2.qml +++ b/tests/auto/declarative/visual/qdeclarativegridview/data/gridview2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/gridview.qml b/tests/auto/declarative/visual/qdeclarativegridview/gridview.qml index f8782a5..f8782a5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/gridview.qml +++ b/tests/auto/declarative/visual/qdeclarativegridview/gridview.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsgridview/gridview2.qml b/tests/auto/declarative/visual/qdeclarativegridview/gridview2.qml index 81d06cf..81d06cf 100644 --- a/tests/auto/declarative/visual/qmlgraphicsgridview/gridview2.qml +++ b/tests/auto/declarative/visual/qdeclarativegridview/gridview2.qml diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.0.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.0.png Binary files differindex cf36d60..cf36d60 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.0.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.0.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.1.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.1.png Binary files differindex 6069df8..6069df8 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.1.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.1.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.2.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.2.png Binary files differindex b8bd5f3..b8bd5f3 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.2.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.2.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.3.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.3.png Binary files differindex cf36d60..cf36d60 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.3.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.3.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.4.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.4.png Binary files differindex 831d6b4..831d6b4 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.4.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.4.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.5.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.5.png Binary files differindex f7079dc..f7079dc 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.5.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.5.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.6.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.6.png Binary files differindex a5f4451..a5f4451 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.6.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.6.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.7.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.7.png Binary files differindex e1261d0..e1261d0 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.7.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.7.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.8.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.8.png Binary files differindex 653905e..653905e 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.8.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.8.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/drag.qml b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.qml index 5a131e9..5a131e9 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/drag.qml +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/drag.qml diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.0.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.0.png Binary files differindex c249c21..c249c21 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.0.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.0.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.1.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.1.png Binary files differindex a96bf1b..a96bf1b 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.1.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.1.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.10.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.10.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.10.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.10.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.11.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.11.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.11.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.11.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.12.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.12.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.12.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.12.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.13.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.13.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.13.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.13.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.14.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.14.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.14.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.14.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.15.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.15.png Binary files differindex e797cc9..e797cc9 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.15.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.15.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.16.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.16.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.16.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.16.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.17.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.17.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.17.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.17.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.18.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.18.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.18.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.18.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.19.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.19.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.19.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.19.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.2.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.2.png Binary files differindex a96bf1b..a96bf1b 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.2.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.2.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.20.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.20.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.20.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.20.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.21.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.21.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.21.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.21.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.22.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.22.png Binary files differindex 7951309..7951309 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.22.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.22.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.3.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.3.png Binary files differindex a96bf1b..a96bf1b 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.3.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.3.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.4.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.4.png Binary files differindex 1fe365a..1fe365a 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.4.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.4.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.5.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.5.png Binary files differindex 1fe365a..1fe365a 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.5.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.5.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.6.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.6.png Binary files differindex 1fe365a..1fe365a 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.6.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.6.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.7.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.7.png Binary files differindex 1fe365a..1fe365a 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.7.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.7.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.8.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.8.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.8.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.8.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.9.png b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.9.png Binary files differindex 7420ca7..7420ca7 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.9.png +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.9.png diff --git a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.qml b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.qml index cc374fd..cc374fd 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/data/mouseregion.qml +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/data/mouseregion.qml diff --git a/tests/auto/declarative/visual/qmlmouseregion/drag.qml b/tests/auto/declarative/visual/qdeclarativemouseregion/drag.qml index dbb2a24..dbb2a24 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/drag.qml +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/drag.qml diff --git a/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml b/tests/auto/declarative/visual/qdeclarativemouseregion/mouseregion.qml index 3c722d0..3c722d0 100644 --- a/tests/auto/declarative/visual/qmlmouseregion/mouseregion.qml +++ b/tests/auto/declarative/visual/qdeclarativemouseregion/mouseregion.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.0.png Binary files differindex 7321d95..7321d95 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.0.png +++ b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.1.png Binary files differindex 49d2a5a..49d2a5a 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.1.png +++ b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.2.png Binary files differindex 6fe14b7..6fe14b7 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.2.png +++ b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.qml index d766dc6..d766dc6 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/data/particles.qml +++ b/tests/auto/declarative/visual/qdeclarativeparticles/data/particles.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml b/tests/auto/declarative/visual/qdeclarativeparticles/particles.qml index 2d481c9..2d481c9 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/particles.qml +++ b/tests/auto/declarative/visual/qdeclarativeparticles/particles.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsparticles/star.png b/tests/auto/declarative/visual/qdeclarativeparticles/star.png Binary files differindex defbde5..defbde5 100644 --- a/tests/auto/declarative/visual/qmlgraphicsparticles/star.png +++ b/tests/auto/declarative/visual/qdeclarativeparticles/star.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.0.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.0.png Binary files differindex 18c8a9e..18c8a9e 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.0.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.1.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.1.png Binary files differindex e86acb4..e86acb4 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.1.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.2.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.2.png Binary files differindex 17990b7..17990b7 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.2.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.3.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.3.png Binary files differindex 18c8a9e..18c8a9e 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.3.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.4.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.4.png Binary files differindex 18c8a9e..18c8a9e 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.4.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.5.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.5.png Binary files differindex 8636f8f..8636f8f 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.5.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.6.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.6.png Binary files differindex fa7c4b6..fa7c4b6 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.6.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.qml b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.qml index b8ff925..b8ff925 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview-2.qml +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview-2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.0.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.0.png Binary files differindex 442ba9f..442ba9f 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.0.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.1.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.1.png Binary files differindex a9ff20f..a9ff20f 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.1.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.2.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.2.png Binary files differindex 157bb99..157bb99 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.2.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.3.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.3.png Binary files differindex 8c49acb..8c49acb 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.3.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.4.png b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.4.png Binary files differindex eb2bf54..eb2bf54 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.4.png +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.qml b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.qml index 8cff5c6..8cff5c6 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/data/test-pathview.qml +++ b/tests/auto/declarative/visual/qdeclarativepathview/data/test-pathview.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview-2.qml b/tests/auto/declarative/visual/qdeclarativepathview/test-pathview-2.qml index c6d71d5..c6d71d5 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview-2.qml +++ b/tests/auto/declarative/visual/qdeclarativepathview/test-pathview-2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml b/tests/auto/declarative/visual/qdeclarativepathview/test-pathview.qml index 0adfa02..0adfa02 100644 --- a/tests/auto/declarative/visual/qmlgraphicspathview/test-pathview.qml +++ b/tests/auto/declarative/visual/qdeclarativepathview/test-pathview.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.0.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.0.png Binary files differindex f474afe..f474afe 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.0.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.1.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.1.png Binary files differindex 8b7ae74..8b7ae74 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.1.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.2.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.2.png Binary files differindex 9088bb4..9088bb4 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.2.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.3.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.3.png Binary files differindex 18cd429..18cd429 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.3.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.4.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.4.png Binary files differindex 739afc1..739afc1 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.4.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.5.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.5.png Binary files differindex 93f0682..93f0682 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.5.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.qml b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.qml index 7091bb3..7091bb3 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/dynamic.qml +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/dynamic.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.0.png b/tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.0.png Binary files differindex f7018fd..f7018fd 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.0.png +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.qml b/tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.qml index 1eb115d..1eb115d 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/data/repeater.qml +++ b/tests/auto/declarative/visual/qdeclarativepositioners/data/repeater.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml b/tests/auto/declarative/visual/qdeclarativepositioners/dynamic.qml index f45e9a4..f45e9a4 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/dynamic.qml +++ b/tests/auto/declarative/visual/qdeclarativepositioners/dynamic.qml diff --git a/tests/auto/declarative/visual/qmlgraphicspositioners/repeater.qml b/tests/auto/declarative/visual/qdeclarativepositioners/repeater.qml index ff60365..ff60365 100644 --- a/tests/auto/declarative/visual/qmlgraphicspositioners/repeater.qml +++ b/tests/auto/declarative/visual/qdeclarativepositioners/repeater.qml diff --git a/tests/auto/declarative/visual/qmlspringfollow/clock.qml b/tests/auto/declarative/visual/qdeclarativespringfollow/clock.qml index 04bbabc..04bbabc 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/clock.qml +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/clock.qml diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/background.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/background.png Binary files differindex a885950..a885950 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/content/background.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/background.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/center.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/center.png Binary files differindex 7fbd802..7fbd802 100755 --- a/tests/auto/declarative/visual/qmlspringfollow/content/center.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/center.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/clock.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/clock.png Binary files differindex 462edac..462edac 100755 --- a/tests/auto/declarative/visual/qmlspringfollow/content/clock.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/clock.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/hour.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/hour.png Binary files differindex f8061a1..f8061a1 100755 --- a/tests/auto/declarative/visual/qmlspringfollow/content/hour.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/hour.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/minute.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/minute.png Binary files differindex 1297ec7..1297ec7 100755 --- a/tests/auto/declarative/visual/qmlspringfollow/content/minute.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/minute.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/content/second.png b/tests/auto/declarative/visual/qdeclarativespringfollow/content/second.png Binary files differindex 4aa9fb5..4aa9fb5 100755 --- a/tests/auto/declarative/visual/qmlspringfollow/content/second.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/content/second.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/clock.0.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.0.png Binary files differindex baf1d45..baf1d45 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/clock.0.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.0.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/clock.1.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.1.png Binary files differindex 932f63f..932f63f 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/clock.1.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.1.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/clock.2.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.2.png Binary files differindex a5cb437..a5cb437 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/clock.2.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.2.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/clock.3.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.3.png Binary files differindex 62e895c..62e895c 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/clock.3.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.3.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/clock.qml b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.qml index ffc6a5e..ffc6a5e 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/clock.qml +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/clock.qml diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.0.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.0.png Binary files differindex 3f42e75..3f42e75 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.0.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.0.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.1.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.1.png Binary files differindex d661df6..d661df6 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.1.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.1.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.10.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.10.png Binary files differindex e8c96e1..e8c96e1 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.10.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.10.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.2.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.2.png Binary files differindex 35bfa43..35bfa43 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.2.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.2.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.3.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.3.png Binary files differindex 74141cf..74141cf 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.3.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.3.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.4.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.4.png Binary files differindex 9544054..9544054 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.4.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.4.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.5.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.5.png Binary files differindex 4b02c79..4b02c79 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.5.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.5.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.6.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.6.png Binary files differindex 8ea8345..8ea8345 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.6.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.6.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.7.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.7.png Binary files differindex 76a73e8..76a73e8 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.7.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.7.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.8.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.8.png Binary files differindex 8824940..8824940 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.8.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.8.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.9.png b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.9.png Binary files differindex f954cc5..f954cc5 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.9.png +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.9.png diff --git a/tests/auto/declarative/visual/qmlspringfollow/data/follow.qml b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.qml index fec5428..fec5428 100644 --- a/tests/auto/declarative/visual/qmlspringfollow/data/follow.qml +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/data/follow.qml diff --git a/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml b/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml new file mode 100644 index 0000000..62503e4 --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativespringfollow/follow.qml @@ -0,0 +1,71 @@ +import Qt 4.6 + +Rectangle { + color: "#ffffff" + width: 320; height: 240 + Rectangle { + id: rect + color: "#00ff00" + y: 200; width: 60; height: 20 + y: SequentialAnimation { + repeat: true + NumberAnimation { + to: 20; duration: 500 + easing.type: "InOutQuad" + } + NumberAnimation { + to: 200; duration: 2000 + easing.type: "OutBounce" + } + PauseAnimation { duration: 1000 } + } + } + + // Velocity + Rectangle { + color: "#ff0000" + x: rect.width; width: rect.width; height: 20 + y: 200 + y: SpringFollow { source: rect.y; velocity: 200 } + } + + // Spring + Rectangle { + color: "#ff0000" + x: rect.width * 2; width: rect.width/2; height: 20 + y: 200 + y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2 } + } + Rectangle { + color: "#880000" + x: rect.width * 2.5; width: rect.width/2; height: 20 + y: 200 + y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object + } + + // Follow mouse + MouseArea { + id: mouseRegion + anchors.fill: parent + Rectangle { + id: ball + width: 20; height: 20 + radius: 10 + color: "#0000ff" + x: SpringFollow { id: f1; source: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + y: SpringFollow { id: f2; source: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } + states: [ + State { + name: "following" + when: !f1.inSync || !f2.inSync + PropertyChanges { target: ball; color: "#ff0000" } + } + ] + transitions: [ + Transition { + ColorAnimation { duration: 200 } + } + ] + } + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstext/baseline/data/parentanchor.qml b/tests/auto/declarative/visual/qdeclarativetext/baseline/data-X11/parentanchor.qml index 56d616e..56d616e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/baseline/data/parentanchor.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/baseline/data-X11/parentanchor.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/baseline/data-X11/parentanchor.qml b/tests/auto/declarative/visual/qdeclarativetext/baseline/data/parentanchor.qml index 56d616e..56d616e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/baseline/data-X11/parentanchor.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/baseline/data/parentanchor.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/baseline/parentanchor.qml b/tests/auto/declarative/visual/qdeclarativetext/baseline/parentanchor.qml index 80f0f03..80f0f03 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/baseline/parentanchor.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/baseline/parentanchor.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.0.png Binary files differindex eea3362..eea3362 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.qml index 1ccede4..1ccede4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.0.png Binary files differindex 3dfade5..3dfade5 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.1.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.1.png Binary files differindex 1ee2076..1ee2076 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.1.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.2.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.2.png Binary files differindex ae680be..ae680be 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.2.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.3.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.3.png Binary files differindex c2859be..c2859be 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.3.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.qml index 07ad236..07ad236 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/elide2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.0.png Binary files differindex 80549b4..80549b4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.qml index c2fd0d8..c2fd0d8 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/multilength.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-MAC/multilength.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.0.png Binary files differindex 5631a46..5631a46 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.qml index cfd832e..cfd832e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/elide.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/elide.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.0.png Binary files differindex 6e2b625..6e2b625 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.qml index 0c06196..0c06196 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-X11/multilength.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data-X11/multilength.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.0.png Binary files differindex 1a8c89b..1a8c89b 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.qml index 59f17f7..59f17f7 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.0.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.0.png Binary files differindex 3dfade5..3dfade5 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.1.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.1.png Binary files differindex 1ee2076..1ee2076 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.1.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.2.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.2.png Binary files differindex ae680be..ae680be 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.2.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.3.png b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.3.png Binary files differindex c2859be..c2859be 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data-MAC/elide2.3.png +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.qml index c592f18..c592f18 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/data/elide2.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/data/elide2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/elide.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/elide.qml index fa6b5da..fa6b5da 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/elide.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/elide.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/elide2.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml index c163e05..c163e05 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/elide2.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/elide2.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/elide/multilength.qml b/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml index ca41eab..ca41eab 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/elide/multilength.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/elide/multilength.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.0.png b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.0.png Binary files differindex 67b497f..67b497f 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.qml index ab17eb1..ab17eb1 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/plaintext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/plaintext.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.0.png b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.0.png Binary files differindex 6379942..6379942 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.qml index 72499b9..72499b9 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data-MAC/richtext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data-MAC/richtext.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.0.png b/tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.0.png Binary files differindex 50d56dc..50d56dc 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.qml index f4cbcbd..f4cbcbd 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data/plaintext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data/plaintext.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.0.png b/tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.0.png Binary files differindex 2910670..2910670 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.0.png +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.qml index 9f396c2..9f396c2 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/data/richtext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/data/richtext.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/plaintext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/plaintext.qml index a3aa929..a3aa929 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/plaintext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/plaintext.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstext/font/richtext.qml b/tests/auto/declarative/visual/qdeclarativetext/font/richtext.qml index 35aa232..35aa232 100644 --- a/tests/auto/declarative/visual/qmlgraphicstext/font/richtext.qml +++ b/tests/auto/declarative/visual/qdeclarativetext/font/richtext.qml diff --git a/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml new file mode 100644 index 0000000..176a5b8 --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativetextedit/cursorDelegate.qml @@ -0,0 +1,35 @@ +import Qt 4.6 + Rectangle { + resources: [ + Component { id: cursorA + Item { id: cPage; + x: Behavior { NumberAnimation { } } + y: Behavior { NumberAnimation { } } + height: Behavior { NumberAnimation { duration: 200 } } + Rectangle { id: cRectangle; color: "black"; y: 1; width: 1; height: parent.height-2; + Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0} + Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} + opacity: 1 + opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} + } + } + width: 1; + } + } + ] + width: 400 + height: 200 + color: "white" + TextEdit { id: mainText + text: "Hello World" + cursorDelegate: cursorA + focus: true + font.pixelSize: 28 + selectionColor: "lightsteelblue" + selectedTextColor: "deeppink" + color: "forestgreen" + anchors.centerIn: parent + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.0.png Binary files differindex 464a578..464a578 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.1.png Binary files differindex 9beb1ca..9beb1ca 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.2.png Binary files differindex 001be30..001be30 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.3.png Binary files differindex fc3e4b3..fc3e4b3 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.4.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.4.png Binary files differindex 24f43e6..24f43e6 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.5.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.5.png Binary files differindex 001223b..001223b 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.6.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.6.png Binary files differindex 7126e07..7126e07 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.7.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.7.png Binary files differindex f0bea88..f0bea88 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.7.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.8.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.8.png Binary files differindex 4381b8d..4381b8d 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.8.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.qml index 8ee92d7..8ee92d7 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/cursorDelegate.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.0.png Binary files differindex cc1774f..cc1774f 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.1.png Binary files differindex 60eba16..60eba16 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.2.png Binary files differindex d4663f7..d4663f7 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.3.png Binary files differindex dc1bb52..dc1bb52 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.qml index 84c16e1..84c16e1 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-MAC/qt-669.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-MAC/qt-669.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.0.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.1.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.2.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.3.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.4.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.4.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.5.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.5.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.6.png b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.6.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.qml index 4ff00f4..4ff00f4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data-X11/wrap.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.0.png Binary files differindex 555996a..555996a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.1.png Binary files differindex b705bad..b705bad 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.2.png Binary files differindex 094cd2a..094cd2a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.3.png Binary files differindex 9c519c7..9c519c7 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.4.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.4.png Binary files differindex 3ec77b5..3ec77b5 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.5.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.5.png Binary files differindex 579a66e..579a66e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.6.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.6.png Binary files differindex 9e5ac90..9e5ac90 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.7.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.7.png Binary files differindex 9f3acfc..9f3acfc 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.7.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.8.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.8.png Binary files differindex f27518a..f27518a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.8.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.qml index 8578d48..8578d48 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/cursorDelegate.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.0.png Binary files differindex 95a835a..95a835a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.1.png Binary files differindex 409192c..409192c 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.2.png Binary files differindex cd2f112..cd2f112 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.3.png Binary files differindex 7191c1e..7191c1e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.qml index 352c890..352c890 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/qt-669.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/qt-669.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.0.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.0.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.1.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.1.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.2.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.2.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.3.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.3.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.4.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.4.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.5.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.5.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.6.png b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.6.png Binary files differindex ec65f49..ec65f49 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data-X11/wrap.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.qml b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.qml index f96daa9..f96daa9 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/data/wrap.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/data/wrap.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/qt-669.qml b/tests/auto/declarative/visual/qdeclarativetextedit/qt-669.qml index b01ddf8..b01ddf8 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/qt-669.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/qt-669.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/wrap.qml b/tests/auto/declarative/visual/qdeclarativetextedit/wrap.qml index f9fe025..f9fe025 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/wrap.qml +++ b/tests/auto/declarative/visual/qdeclarativetextedit/wrap.qml diff --git a/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml new file mode 100644 index 0000000..6a4e7fa --- /dev/null +++ b/tests/auto/declarative/visual/qdeclarativetextinput/cursorDelegate.qml @@ -0,0 +1,35 @@ +import Qt 4.6 + Rectangle { + resources: [ + Component { id: cursorA + Item { id: cPage; + x: Behavior { NumberAnimation { } } + y: Behavior { NumberAnimation { } } + height: Behavior { NumberAnimation { duration: 200 } } + Rectangle { id: cRectangle; color: "black"; y: 1; width: 1; height: parent.height-2; + Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0} + Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} + opacity: 1 + opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; + NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing.type: "InQuad"} + NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing.type: "OutQuad"} + } + } + width: 1; + } + } + ] + width: 400 + height: 200 + color: "white" + TextInput { id: mainText + text: "Hello World" + cursorDelegate: cursorA + focus: true + font.pixelSize: 28 + selectionColor: "lightsteelblue" + selectedTextColor: "deeppink" + color: "forestgreen" + anchors.centerIn: parent + } +} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.0.png Binary files differindex 9d0bab2..9d0bab2 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.1.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.1.png Binary files differindex db66ff7..db66ff7 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.2.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.2.png Binary files differindex cbcca68..cbcca68 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.3.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.3.png Binary files differindex c22196b..c22196b 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.4.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.4.png Binary files differindex a1d051e..a1d051e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.5.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.5.png Binary files differindex 9289dc0..9289dc0 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.6.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.6.png Binary files differindex 7331f89..7331f89 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.7.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.7.png Binary files differindex 968bdd2..968bdd2 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.7.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.8.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.8.png Binary files differindex 9a3436a..9a3436a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.8.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.qml index 3b664b6..3b664b6 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-MAC/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-MAC/cursorDelegate.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.0.png Binary files differindex 2b45a06..2b45a06 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.1.png Binary files differindex 1f5bae0..1f5bae0 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.2.png Binary files differindex cb2b5a4..cb2b5a4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.3.png Binary files differindex aa24805..aa24805 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.4.png Binary files differindex aa24805..aa24805 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.qml index dd7b291..dd7b291 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/echoMode.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.0.png Binary files differindex 87c2e07..87c2e07 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.qml index e29ac56..e29ac56 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/hAlign.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data-X11/hAlign.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.0.png Binary files differindex f04f65e..f04f65e 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.1.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.1.png Binary files differindex 46a703a..46a703a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.2.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.2.png Binary files differindex e4a3877..e4a3877 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.3.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.3.png Binary files differindex 9ef842a..9ef842a 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.4.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.4.png Binary files differindex 706e2b3..706e2b3 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.5.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.5.png Binary files differindex bcc86cc..bcc86cc 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.5.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.5.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.6.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.6.png Binary files differindex 51ddd44..51ddd44 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.6.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.6.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.7.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.7.png Binary files differindex 0a2fdda..0a2fdda 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.7.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.7.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.8.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.8.png Binary files differindex 9c88bff..9c88bff 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.8.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.8.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.qml index df2dd38..df2dd38 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/cursorDelegate.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/cursorDelegate.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.0.png Binary files differindex 2b45a06..2b45a06 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.1.png Binary files differindex 1f5bae0..1f5bae0 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.1.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.1.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.2.png Binary files differindex cb2b5a4..cb2b5a4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.2.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.2.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.3.png Binary files differindex aa24805..aa24805 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.3.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.3.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.4.png Binary files differindex aa24805..aa24805 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/echoMode.4.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.4.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.qml index 873a86d..873a86d 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data/echoMode.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/echoMode.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png b/tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.0.png Binary files differindex 87c2e07..87c2e07 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.0.png +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.0.png diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml b/tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.qml index e29ac56..e29ac56 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/data-X11/hAlign.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/data/hAlign.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml b/tests/auto/declarative/visual/qdeclarativetextinput/echoMode.qml index b0b50e4..b0b50e4 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/echoMode.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/echoMode.qml diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml b/tests/auto/declarative/visual/qdeclarativetextinput/hAlign.qml index 2d65adf..2d65adf 100644 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/hAlign.qml +++ b/tests/auto/declarative/visual/qdeclarativetextinput/hAlign.qml diff --git a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml b/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml deleted file mode 100644 index eb1ec00..0000000 --- a/tests/auto/declarative/visual/qmlgraphicsborderimage/content/MyBorderImage.qml +++ /dev/null @@ -1,38 +0,0 @@ -import Qt 4.6 - -Item { - property alias horizontalMode: image.horizontalTileMode - property alias verticalMode: image.verticalTileMode - property alias source: image.source - property alias antialiased: image.smooth - - property int minWidth - property int minHeight - property int maxWidth - property int maxHeight - property int margin - - id: container - width: 240; height: 240 - - BorderImage { - id: image; x: container.width / 2 - width / 2; y: container.height / 2 - height / 2 - - width: SequentialAnimation { - repeat: true - NumberAnimation { from: container.minWidth; to: container.maxWidth; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxWidth; to: container.minWidth; duration: 2000; easing: "easeInOutQuad" } - } - - height: SequentialAnimation { - repeat: true - NumberAnimation { from: container.minHeight; to: container.maxHeight; duration: 2000; easing: "easeInOutQuad"} - NumberAnimation { from: container.maxHeight; to: container.minHeight; duration: 2000; easing: "easeInOutQuad" } - } - - border.top: container.margin - border.left: container.margin - border.bottom: container.margin - border.right: container.margin - } -} diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-horizontal.qml b/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-horizontal.qml deleted file mode 100644 index 1a7366d..0000000 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-horizontal.qml +++ /dev/null @@ -1,37 +0,0 @@ -import Qt 4.6 - -Rectangle { - color: "lightSteelBlue" - width: 600; height: 300 - - ListModel { - id: list - ListElement { dayColor: "steelblue" } - ListElement { dayColor: "blue" } - ListElement { dayColor: "yellow" } - ListElement { dayColor: "purple" } - ListElement { dayColor: "red" } - ListElement { dayColor: "green" } - ListElement { dayColor: "orange" } - } - - Flickable { - id: flickable - anchors.fill: parent; viewportWidth: row.width - - Row { - id: row - Repeater { - model: list - Rectangle { width: 200; height: 300; color: dayColor } - } - } - } - Rectangle { - radius: 3 - y: flickable.height-8 - height: 8 - x: flickable.visibleArea.xPosition * flickable.width - width: flickable.visibleArea.widthRatio * flickable.width - } -} diff --git a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml b/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml deleted file mode 100644 index 6204aa9..0000000 --- a/tests/auto/declarative/visual/qmlgraphicsflickable/flickable-vertical.qml +++ /dev/null @@ -1,91 +0,0 @@ -import Qt 4.6 - -Rectangle { - color: "lightSteelBlue" - width: 300; height: 600 - - ListModel { - id: list - ListElement { dayColor: "steelblue" } - ListElement { dayColor: "blue" } - ListElement { dayColor: "yellow" } - ListElement { dayColor: "purple" } - ListElement { dayColor: "red" } - ListElement { dayColor: "green" } - ListElement { dayColor: "orange" } - } - - flickable { - id: flick - height: parent.height-50 - width: parent.width; viewportHeight: column.height - - Column { - id: column - Repeater { - model: list - Rectangle { width: 300; height: 200; color: mr.pressed ? "black" : dayColor - MouseArea { - id: mr - anchors.fill: parent - } - } - } - } - clip: true - reportedVelocitySmoothing: 1000 - } - Rectangle { - radius: 3 - x: flick.width-8 - width: 8 - y: flick.visibleArea.yPosition * flick.height - height: flick.visibleArea.heightRatio * flick.height - } - - // click to toggle interactive flag - Rectangle { - width: 64 - height: 48 - y: parent.height - 50 - color: "red" - MouseArea { - anchors.fill: parent - onClicked: flick.interactive = flick.interactive ? false : true - } - } - - // click to toggle click delay - Rectangle { - width: 64 - height: 48 - x: 66 - y: parent.height - 50 - color: "green" - MouseArea { - anchors.fill: parent - onClicked: flick.pressDelay = flick.pressDelay > 0 ? 0 : 500 - } - } - - // click to toggle overshoot - Rectangle { - width: 64 - height: 48 - x: 130 - y: parent.height - 50 - color: "yellow" - MouseArea { - anchors.fill: parent - onClicked: flick.overShoot = flick.overShoot > 0 ? 0 : 30 - } - } - - Rectangle { - width: Math.abs(flick.verticalVelocity)/100 - height: 50 - x: 200 - y: parent.height - 50 - color: blue - } -} diff --git a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml b/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml deleted file mode 100644 index c33a319..0000000 --- a/tests/auto/declarative/visual/qmlgraphicsflipable/test-flipable.qml +++ /dev/null @@ -1,79 +0,0 @@ -import Qt 4.6 - -Rectangle { - width: 400; height: 240 - color: "white" - - Timer { - interval: 3000; running: true; repeat: true; triggeredOnStart: true - onTriggered: { - if (flipable.state == '') flipable.state = 'back'; else flipable.state = '' - if (flipable2.state == '') flipable2.state = 'back'; else flipable2.state = '' - } - } - - Flipable { - id: flipable - width: 200; height: 200 - - transform: Rotation { - id: rotation; angle: 0 - origin.x: 100; origin.y: 100 - axis.x: 0; axis.y: 1; axis.z: 0 - } - - front: Rectangle { - color: "steelblue"; width: 200; height: 200 - } - - back: Rectangle { - color: "deeppink"; width: 200; height: 200 - } - - states: State { - name: "back" - PropertyChanges { target: rotation; angle: 180 } - } - - transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } - } - } - - Flipable { - id: flipable2 - x: 200; width: 200; height: 200 - - transform: Rotation { - id: rotation2; angle: 0 - origin.x: 100; origin.y: 100 - axis.x: 1; axis.z: 0 - } - - front: Rectangle { - color: "deeppink"; width: 200; height: 200 - } - - back: Rectangle { - color: "steelblue"; width: 200; height: 200 - } - - states: State { - name: "back" - PropertyChanges { target: rotation2; angle: 180 } - } - - transitions: Transition { - NumberAnimation { easing: "easeInOutQuad"; properties: "angle"; duration: 3000 } - } - } - - Rectangle { - x: 25; width: 150; y: 210; height: 20; color: "black" - visible: flipable.side == Flipable.Front - } - Rectangle { - x: 225; width: 150; y: 210; height: 20; color: "black" - visible: flipable2.side == Flipable.Back - } -} diff --git a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml deleted file mode 100644 index e0c5db4..0000000 --- a/tests/auto/declarative/visual/qmlgraphicstextedit/cursorDelegate.qml +++ /dev/null @@ -1,35 +0,0 @@ -import Qt 4.6 - Rectangle { - resources: [ - Component { id: cursorA - Item { id: cPage; - x: Behavior { NumberAnimation { } } - y: Behavior { NumberAnimation { } } - height: Behavior { NumberAnimation { duration: 200 } } - Rectangle { id: cRectangle; color: "black"; y: 1; width: 1; height: parent.height-2; - Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0} - Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} - opacity: 1 - opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} - } - } - width: 1; - } - } - ] - width: 400 - height: 200 - color: "white" - TextEdit { id: mainText - text: "Hello World" - cursorDelegate: cursorA - focus: true - font.pixelSize: 28 - selectionColor: "lightsteelblue" - selectedTextColor: "deeppink" - color: "forestgreen" - anchors.centerIn: parent - } -} diff --git a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml b/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml deleted file mode 100644 index 0038664..0000000 --- a/tests/auto/declarative/visual/qmlgraphicstextinput/cursorDelegate.qml +++ /dev/null @@ -1,35 +0,0 @@ -import Qt 4.6 - Rectangle { - resources: [ - Component { id: cursorA - Item { id: cPage; - x: Behavior { NumberAnimation { } } - y: Behavior { NumberAnimation { } } - height: Behavior { NumberAnimation { duration: 200 } } - Rectangle { id: cRectangle; color: "black"; y: 1; width: 1; height: parent.height-2; - Rectangle { id:top; color: "black"; width: 3; height: 1; x: -1; y:0} - Rectangle { id:bottom; color: "black"; width: 3; height: 1; x: -1; anchors.bottom: parent.bottom;} - opacity: 1 - opacity: SequentialAnimation { running: cPage.parent.focus == true; repeat: true; - NumberAnimation { properties: "opacity"; to: 1; duration: 500; easing: "easeInQuad"} - NumberAnimation { properties: "opacity"; to: 0; duration: 500; easing: "easeOutQuad"} - } - } - width: 1; - } - } - ] - width: 400 - height: 200 - color: "white" - TextInput { id: mainText - text: "Hello World" - cursorDelegate: cursorA - focus: true - font.pixelSize: 28 - selectionColor: "lightsteelblue" - selectedTextColor: "deeppink" - color: "forestgreen" - anchors.centerIn: parent - } -} diff --git a/tests/auto/declarative/visual/qmlspringfollow/follow.qml b/tests/auto/declarative/visual/qmlspringfollow/follow.qml deleted file mode 100644 index a85a778..0000000 --- a/tests/auto/declarative/visual/qmlspringfollow/follow.qml +++ /dev/null @@ -1,71 +0,0 @@ -import Qt 4.6 - -Rectangle { - color: "#ffffff" - width: 320; height: 240 - Rectangle { - id: rect - color: "#00ff00" - y: 200; width: 60; height: 20 - y: SequentialAnimation { - repeat: true - NumberAnimation { - to: 20; duration: 500 - easing: "easeInOutQuad" - } - NumberAnimation { - to: 200; duration: 2000 - easing: "easeOutBounce" - } - PauseAnimation { duration: 1000 } - } - } - - // Velocity - Rectangle { - color: "#ff0000" - x: rect.width; width: rect.width; height: 20 - y: 200 - y: SpringFollow { source: rect.y; velocity: 200 } - } - - // Spring - Rectangle { - color: "#ff0000" - x: rect.width * 2; width: rect.width/2; height: 20 - y: 200 - y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2 } - } - Rectangle { - color: "#880000" - x: rect.width * 2.5; width: rect.width/2; height: 20 - y: 200 - y: SpringFollow { source: rect.y; spring: 1.0; damping: 0.2; mass: 3.0 } // "heavier" object - } - - // Follow mouse - MouseArea { - id: mouseRegion - anchors.fill: parent - Rectangle { - id: ball - width: 20; height: 20 - radius: 10 - color: "#0000ff" - x: SpringFollow { id: f1; source: mouseRegion.mouseX-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } - y: SpringFollow { id: f2; source: mouseRegion.mouseY-10; spring: 1.0; damping: 0.05; epsilon: 0.25 } - states: [ - State { - name: "following" - when: !f1.inSync || !f2.inSync - PropertyChanges { target: ball; color: "#ff0000" } - } - ] - transitions: [ - Transition { - ColorAnimation { duration: 200 } - } - ] - } - } -} diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp index 8f41bef..cd88e87 100644 --- a/tests/auto/declarative/visual/tst_visual.cpp +++ b/tests/auto/declarative/visual/tst_visual.cpp @@ -39,7 +39,7 @@ ** ****************************************************************************/ #include <qtest.h> -#include <QmlView> +#include <QDeclarativeView> #include <QApplication> #include <QLibraryInfo> #include <QDir> @@ -65,30 +65,30 @@ private slots: void visual(); private: - QString qmlviewer; + QString qmlruntime; }; tst_visual::tst_visual() { - qmlviewer = viewer(); + qmlruntime = viewer(); } QString tst_visual::viewer() { QString binaries = QLibraryInfo::location(QLibraryInfo::BinariesPath); - QString qmlviewer; + QString qmlruntime; #if defined(Q_WS_MAC) - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer.app/Contents/MacOS/qmlviewer"); + qmlruntime = QDir(binaries).absoluteFilePath("qml.app/Contents/MacOS/qml"); #elif defined(Q_WS_WIN) - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer.exe"); + qmlruntime = QDir(binaries).absoluteFilePath("qml.exe"); #else - qmlviewer = QDir(binaries).absoluteFilePath("qmlviewer"); + qmlruntime = QDir(binaries).absoluteFilePath("qml"); #endif - return qmlviewer; + return qmlruntime; } void tst_visual::visual_data() @@ -118,7 +118,7 @@ void tst_visual::visual() << "-scriptopts" << "play,testimages,testerror,exitoncomplete,exitonfailure" << file; QProcess p; - p.start(qmlviewer, arguments); + p.start(qmlruntime, arguments); QVERIFY(p.waitForFinished()); if (p.exitCode() != 0) qDebug() << p.readAllStandardError(); @@ -211,7 +211,7 @@ void action(Mode mode, const QString &file) QStringList arguments; switch (mode) { case Test: - // Don't run qmlviewer + // Don't run qml break; case Record: arguments << "-script" << testdata diff --git a/tests/auto/qabstractproxymodel/tst_qabstractproxymodel.cpp b/tests/auto/qabstractproxymodel/tst_qabstractproxymodel.cpp index 6d92d03..88c2ef1 100644 --- a/tests/auto/qabstractproxymodel/tst_qabstractproxymodel.cpp +++ b/tests/auto/qabstractproxymodel/tst_qabstractproxymodel.cpp @@ -80,6 +80,7 @@ private slots: void setSourceModel(); void submit_data(); void submit(); + void testRoleNames(); }; // Subclass that exposes the protected functions. @@ -362,6 +363,87 @@ void tst_QAbstractProxyModel::submit() QCOMPARE(model.submit(), submit); } +class StandardItemModelWithCustomRoleNames : public QStandardItemModel +{ +public: + enum CustomRole { + CustomRole1 = Qt::UserRole, + CustomRole2 + }; + + StandardItemModelWithCustomRoleNames() { + QHash<int, QByteArray> _roleNames = roleNames(); + _roleNames.insert(CustomRole1, "custom1"); + _roleNames.insert(CustomRole2, "custom2"); + setRoleNames(_roleNames); + } +}; + +class AnotherStandardItemModelWithCustomRoleNames : public QStandardItemModel +{ + public: + enum CustomRole { + AnotherCustomRole1 = Qt::UserRole + 10, // Different to StandardItemModelWithCustomRoleNames::CustomRole1 + AnotherCustomRole2 + }; + + AnotherStandardItemModelWithCustomRoleNames() { + QHash<int, QByteArray> _roleNames = roleNames(); + _roleNames.insert(AnotherCustomRole1, "another_custom1"); + _roleNames.insert(AnotherCustomRole2, "another_custom2"); + setRoleNames(_roleNames); + } +}; + +/** + Verifies that @p subSet is a subset of @p superSet. That is, all keys in @p subSet exist in @p superSet and have the same values. +*/ +static void verifySubSetOf(const QHash<int, QByteArray> &superSet, const QHash<int, QByteArray> &subSet) +{ + QHash<int, QByteArray>::const_iterator it = subSet.constBegin(); + const QHash<int, QByteArray>::const_iterator end = subSet.constEnd(); + for ( ; it != end; ++it ) { + QVERIFY(superSet.contains(it.key())); + QVERIFY(it.value() == superSet.value(it.key())); + } +} + +void tst_QAbstractProxyModel::testRoleNames() +{ + QStandardItemModel defaultModel; + StandardItemModelWithCustomRoleNames model; + QHash<int, QByteArray> rootModelRoleNames = model.roleNames(); + QHash<int, QByteArray> defaultModelRoleNames = defaultModel.roleNames(); + + verifySubSetOf( rootModelRoleNames, defaultModelRoleNames); + QVERIFY( rootModelRoleNames.size() == defaultModelRoleNames.size() + 2 ); + QVERIFY( rootModelRoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole1)); + QVERIFY( rootModelRoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole2)); + QVERIFY( rootModelRoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole1) == "custom1" ); + QVERIFY( rootModelRoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole2) == "custom2" ); + + SubQAbstractProxyModel proxy1; + proxy1.setSourceModel(&model); + QHash<int, QByteArray> proxy1RoleNames = proxy1.roleNames(); + verifySubSetOf( proxy1RoleNames, defaultModelRoleNames ); + QVERIFY( proxy1RoleNames.size() == defaultModelRoleNames.size() + 2 ); + QVERIFY( proxy1RoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole1)); + QVERIFY( proxy1RoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole2)); + QVERIFY( proxy1RoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole1) == "custom1" ); + QVERIFY( proxy1RoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole2) == "custom2" ); + + SubQAbstractProxyModel proxy2; + proxy2.setSourceModel(&proxy1); + QHash<int, QByteArray> proxy2RoleNames = proxy2.roleNames(); + verifySubSetOf( proxy2RoleNames, defaultModelRoleNames ); + QVERIFY( proxy2RoleNames.size() == defaultModelRoleNames.size() + 2 ); + QVERIFY( proxy2RoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole1)); + QVERIFY( proxy2RoleNames.contains(StandardItemModelWithCustomRoleNames::CustomRole2)); + QVERIFY( proxy2RoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole1) == "custom1" ); + QVERIFY( proxy2RoleNames.value(StandardItemModelWithCustomRoleNames::CustomRole2) == "custom2" ); + +} + QTEST_MAIN(tst_QAbstractProxyModel) #include "tst_qabstractproxymodel.moc" diff --git a/tests/auto/qdatastream/tst_qdatastream.cpp b/tests/auto/qdatastream/tst_qdatastream.cpp index c94ea7b..31e12fe 100644 --- a/tests/auto/qdatastream/tst_qdatastream.cpp +++ b/tests/auto/qdatastream/tst_qdatastream.cpp @@ -162,6 +162,9 @@ private slots: void stream_QIcon_data(); void stream_QIcon(); + void stream_QEasingCurve_data(); + void stream_QEasingCurve(); + void stream_atEnd_data(); void stream_atEnd(); @@ -243,6 +246,7 @@ private: void writeqint64(QDataStream *s); void writeQWMatrix(QDataStream *s); void writeQIcon(QDataStream *s); + void writeQEasingCurve(QDataStream *s); void readbool(QDataStream *s); void readQBool(QDataStream *s); @@ -272,6 +276,7 @@ private: void readqint64(QDataStream *s); void readQWMatrix(QDataStream *s); void readQIcon(QDataStream *s); + void readQEasingCurve(QDataStream *s); private: QString svgFile; @@ -687,6 +692,70 @@ void tst_QDataStream::readHash(QDataStream *s) // ************************************ +static QEasingCurve QEasingCurveData(int index) +{ + QEasingCurve easing; + + switch (index) { + case 0: + default: + break; + case 1: + easing.setType(QEasingCurve::Linear); + break; + case 2: + easing.setType(QEasingCurve::OutCubic); + break; + case 3: + easing.setType(QEasingCurve::InOutSine); + break; + case 4: + easing.setType(QEasingCurve::InOutElastic); + easing.setPeriod(1.5); + easing.setAmplitude(2.0); + break; + case 5: + easing.setType(QEasingCurve::OutInBack); + break; + case 6: + easing.setType(QEasingCurve::OutCurve); + break; + case 7: + easing.setType(QEasingCurve::InOutBack); + easing.setOvershoot(0.5); + break; + } + return easing; +} +#define MAX_EASING_DATA 8 + +void tst_QDataStream::stream_QEasingCurve_data() +{ + stream_data(MAX_EASING_DATA); +} + +void tst_QDataStream::stream_QEasingCurve() +{ + STREAM_IMPL(QEasingCurve); +} + +void tst_QDataStream::writeQEasingCurve(QDataStream* s) +{ + QEasingCurve test(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + *s << test; +} + +void tst_QDataStream::readQEasingCurve(QDataStream *s) +{ + QEasingCurve S; + QEasingCurve expected(QEasingCurveData(dataIndex(QTest::currentDataTag()))); + + *s >> S; + QCOMPARE(S, expected); +} + +// ************************************ + // contains some quint64 testing as well #define MAX_qint64_DATA 4 diff --git a/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro new file mode 100644 index 0000000..13bf606 --- /dev/null +++ b/tests/auto/qdeclarativeaudio/qdeclarativeaudio.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qdeclarativeaudio.cpp + +QT += multimedia declarative diff --git a/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp new file mode 100644 index 0000000..11439ce --- /dev/null +++ b/tests/auto/qdeclarativeaudio/tst_qdeclarativeaudio.cpp @@ -0,0 +1,1200 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> + +#include <QtMultimedia/private/qdeclarativeaudio_p.h> + +#include <QtGui/qapplication.h> +#include <QtMultimedia/qmediaplayercontrol.h> +#include <QtMultimedia/qmediaservice.h> +#include <QtMultimedia/qmetadatacontrol.h> + + +class tst_QmlAudio : public QObject +{ + Q_OBJECT +public slots: + void initTestCase(); + +private slots: + void nullPlayerControl(); + void nullMetaDataControl(); + void nullService(); + + void source(); + void playing(); + void paused(); + void duration(); + void position(); + void volume(); + void muted(); + void bufferProgress(); + void seekable(); + void playbackRate(); + void status(); + void metaData_data(); + void metaData(); + void error(); +}; + +Q_DECLARE_METATYPE(QtMultimedia::MetaData); +Q_DECLARE_METATYPE(QDeclarativeAudio::Error); + +class QtTestMediaPlayerControl : public QMediaPlayerControl +{ + Q_OBJECT +public: + QtTestMediaPlayerControl(QObject *parent = 0) + : QMediaPlayerControl(parent) + , m_state(QMediaPlayer::StoppedState) + , m_mediaStatus(QMediaPlayer::NoMedia) + , m_duration(0) + , m_position(0) + , m_playbackRate(1.0) + , m_volume(50) + , m_bufferStatus(0) + , m_muted(false) + , m_audioAvailable(false) + , m_videoAvailable(false) + , m_seekable(false) + { + } + + QMediaPlayer::State state() const { return m_state; } + void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); } + + QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; } + void updateMediaStatus(QMediaPlayer::MediaStatus status) { + emit mediaStatusChanged(m_mediaStatus = status); } + void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state) + { + m_mediaStatus = status; + m_state = state; + + emit mediaStatusChanged(m_mediaStatus); + emit stateChanged(m_state); + } + + qint64 duration() const { return m_duration; } + void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); } + + qint64 position() const { return m_position; } + void setPosition(qint64 position) { emit positionChanged(m_position = position); } + + int volume() const { return m_volume; } + void setVolume(int volume) { emit volumeChanged(m_volume = volume); } + + bool isMuted() const { return m_muted; } + void setMuted(bool muted) { emit mutedChanged(m_muted = muted); } + + int bufferStatus() const { return m_bufferStatus; } + void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); } + + bool isAudioAvailable() const { return m_audioAvailable; } + void setAudioAvailable(bool available) { + emit audioAvailableChanged(m_audioAvailable = available); } + bool isVideoAvailable() const { return m_videoAvailable; } + void setVideoAvailable(bool available) { + emit videoAvailableChanged(m_videoAvailable = available); } + + bool isSeekable() const { return m_seekable; } + void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); } + + QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } + + qreal playbackRate() const { return m_playbackRate; } + void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); } + + QMediaContent media() const { return m_media; } + const QIODevice *mediaStream() const { return 0; } + void setMedia(const QMediaContent &media, QIODevice *) + { + m_media = media; + + m_mediaStatus = m_media.isNull() + ? QMediaPlayer::NoMedia + : QMediaPlayer::LoadingMedia; + + emit mediaChanged(m_media); + emit mediaStatusChanged(m_mediaStatus); + } + + void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); } + void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); } + void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); } + + void emitError(QMediaPlayer::Error err, const QString &errorString) { + emit error(err, errorString); } + +private: + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_mediaStatus; + qint64 m_duration; + qint64 m_position; + qreal m_playbackRate; + int m_volume; + int m_bufferStatus; + bool m_muted; + bool m_audioAvailable; + bool m_videoAvailable; + bool m_seekable; + QMediaContent m_media; +}; + +class QtTestMetaDataControl : public QMetaDataControl +{ + Q_OBJECT +public: + QtTestMetaDataControl(QObject *parent = 0) + : QMetaDataControl(parent) + { + } + + bool isWritable() const { return true; } + bool isMetaDataAvailable() const { return true; } + + QVariant metaData(QtMultimedia::MetaData key) const { return m_metaData.value(key); } + void setMetaData(QtMultimedia::MetaData key, const QVariant &value) { + m_metaData.insert(key, value); emit metaDataChanged(); } + void setMetaData(const QMap<QtMultimedia::MetaData, QVariant> &metaData) { + m_metaData = metaData; emit metaDataChanged(); } + + QList<QtMultimedia::MetaData> availableMetaData() const { return m_metaData.keys(); } + + QVariant extendedMetaData(const QString &) const { return QVariant(); } + void setExtendedMetaData(const QString &, const QVariant &) {} + QStringList availableExtendedMetaData() const { return QStringList(); } + +private: + QMap<QtMultimedia::MetaData, QVariant> m_metaData; +}; + +class QtTestMediaService : public QMediaService +{ + Q_OBJECT +public: + QtTestMediaService( + QtTestMediaPlayerControl *playerControl, + QtTestMetaDataControl *metaDataControl, + QObject *parent) + : QMediaService(parent) + , playerControl(playerControl) + , metaDataControl(metaDataControl) + { + } + + QMediaControl *control(const char *name) const + { + if (qstrcmp(name, QMediaPlayerControl_iid) == 0) + return playerControl; + else if (qstrcmp(name, QMetaDataControl_iid) == 0) + return metaDataControl; + else + return 0; + } + + QtTestMediaPlayerControl *playerControl; + QtTestMetaDataControl *metaDataControl; +}; + +class QtTestMediaServiceProvider : public QMediaServiceProvider +{ + Q_OBJECT +public: + QtTestMediaServiceProvider() + : service(new QtTestMediaService( + new QtTestMediaPlayerControl(this), new QtTestMetaDataControl(this), this)) + { + setDefaultServiceProvider(this); + } + + QtTestMediaServiceProvider(QtTestMediaService *service) + : service(service) + { + setDefaultServiceProvider(this); + } + + QtTestMediaServiceProvider( + QtTestMediaPlayerControl *playerControl, QtTestMetaDataControl *metaDataControl) + : service(new QtTestMediaService(playerControl, metaDataControl, this)) + { + setDefaultServiceProvider(this); + } + + ~QtTestMediaServiceProvider() + { + setDefaultServiceProvider(0); + } + + QMediaService *requestService( + const QByteArray &type, + const QMediaServiceProviderHint & = QMediaServiceProviderHint()) + { + requestedService = type; + + return service; + } + + void releaseService(QMediaService *) {} + + inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; } + inline QtTestMetaDataControl *metaDataControl() { return service->metaDataControl; } + + QtTestMediaService *service; + QByteArray requestedService; +}; + + +void tst_QmlAudio::initTestCase() +{ + qRegisterMetaType<QDeclarativeAudio::Error>(); +} + +void tst_QmlAudio::nullPlayerControl() +{ + QtTestMetaDataControl metaDataControl; + QtTestMediaServiceProvider provider(0, &metaDataControl); + + QDeclarativeAudio audio; + + QCOMPARE(audio.source(), QUrl()); + audio.setSource(QUrl("http://example.com")); + QCOMPARE(audio.source(), QUrl()); + + QCOMPARE(audio.isPlaying(), false); + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), false); + audio.play(); + QCOMPARE(audio.isPlaying(), false); + + QCOMPARE(audio.isPaused(), false); + audio.pause(); + QCOMPARE(audio.isPaused(), false); + audio.setPaused(true); + QCOMPARE(audio.isPaused(), true); + + QCOMPARE(audio.duration(), 0); + + QCOMPARE(audio.position(), 0); + audio.setPosition(10000); + QCOMPARE(audio.position(), 0); + + QCOMPARE(audio.volume(), qreal(0)); + audio.setVolume(50); + QCOMPARE(audio.volume(), qreal(0)); + + QCOMPARE(audio.isMuted(), false); + audio.setMuted(true); + QCOMPARE(audio.isMuted(), false); + + QCOMPARE(audio.bufferProgress(), qreal(0)); + + QCOMPARE(audio.isSeekable(), false); + + QCOMPARE(audio.playbackRate(), qreal(1.0)); + + QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia); + + QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing); +} + +void tst_QmlAudio::nullMetaDataControl() +{ + QtTestMediaPlayerControl playerControl; + QtTestMediaServiceProvider provider(&playerControl, 0); + + QDeclarativeAudio audio; + + QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1); + QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1); + QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); +} + +void tst_QmlAudio::nullService() +{ + QtTestMediaServiceProvider provider(0); + + QDeclarativeAudio audio; + + QCOMPARE(audio.source(), QUrl()); + audio.setSource(QUrl("http://example.com")); + QCOMPARE(audio.source(), QUrl()); + + QCOMPARE(audio.isPlaying(), false); + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), false); + audio.play(); + QCOMPARE(audio.isPlaying(), false); + + QCOMPARE(audio.isPaused(), false); + audio.pause(); + QCOMPARE(audio.isPaused(), false); + audio.setPaused(true); + QCOMPARE(audio.isPaused(), true); + + QCOMPARE(audio.duration(), 0); + + QCOMPARE(audio.position(), 0); + audio.setPosition(10000); + QCOMPARE(audio.position(), 0); + + QCOMPARE(audio.volume(), qreal(0)); + audio.setVolume(50); + QCOMPARE(audio.volume(), qreal(0)); + + QCOMPARE(audio.isMuted(), false); + audio.setMuted(true); + QCOMPARE(audio.isMuted(), false); + + QCOMPARE(audio.bufferProgress(), qreal(0)); + + QCOMPARE(audio.isSeekable(), false); + + QCOMPARE(audio.playbackRate(), qreal(1.0)); + + QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia); + + QCOMPARE(audio.error(), QDeclarativeAudio::ServiceMissing); + + QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1); + QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1); + QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); +} + +void tst_QmlAudio::source() +{ + const QUrl url1("http://example.com"); + const QUrl url2("file:///local/path"); + const QUrl url3; + + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(sourceChanged())); + + audio.setSource(url1); + QCOMPARE(audio.source(), url1); + QCOMPARE(provider.playerControl()->media().canonicalUrl(), url1); + QCOMPARE(spy.count(), 1); + + audio.setSource(url2); + QCOMPARE(audio.source(), url2); + QCOMPARE(provider.playerControl()->media().canonicalUrl(), url2); + QCOMPARE(spy.count(), 2); + + audio.setSource(url3); + QCOMPARE(audio.source(), url3); + QCOMPARE(provider.playerControl()->media().canonicalUrl(), url3); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlAudio::playing() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged())); + QSignalSpy startedSpy(&audio, SIGNAL(started())); + QSignalSpy stoppedSpy(&audio, SIGNAL(stopped())); + + int playingChanged = 0; + int started = 0; + int stopped = 0; + + QCOMPARE(audio.isPlaying(), false); + + // setPlaying(true) when stopped. + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when playing. + audio.setPlaying(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // play() when stopped. + audio.play(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when playing. + audio.stop(); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // stop() when stopped. + audio.stop(); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when stopped. + audio.setPlaying(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(true) when playing. + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + // play() when playing. + audio.play(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); +} + +void tst_QmlAudio::paused() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged())); + QSignalSpy pausedChangedSpy(&audio, SIGNAL(pausedChanged())); + QSignalSpy startedSpy(&audio, SIGNAL(started())); + QSignalSpy pausedSpy(&audio, SIGNAL(paused())); + QSignalSpy resumedSpy(&audio, SIGNAL(resumed())); + QSignalSpy stoppedSpy(&audio, SIGNAL(stopped())); + + int playingChanged = 0; + int pausedChanged = 0; + int started = 0; + int paused = 0; + int resumed = 0; + int stopped = 0; + + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), false); + + // setPlaying(true) when stopped. + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when playing. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when paused. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when paused. + audio.pause(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when paused. + audio.setPaused(false); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), ++resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when playing. + audio.setPaused(false); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when playing. + audio.pause(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + audio.setPlaying(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // setPaused(true) when stopped and paused. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when stopped and paused. + audio.setPaused(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when stopped. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(true) when stopped and paused. + audio.setPlaying(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // play() when paused. + audio.play(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), ++resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when playing. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when paused. + audio.stop(); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // setPaused(true) when stopped. + audio.setPaused(true); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when stopped and paused. + audio.stop(); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when stopped. + audio.pause(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + audio.setPlaying(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // pause() when stopped and paused. + audio.pause(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + audio.setPlaying(false); + QCOMPARE(audio.isPlaying(), false); + QCOMPARE(audio.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // play() when stopped and paused. + audio.play(); + QCOMPARE(audio.isPlaying(), true); + QCOMPARE(audio.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); +} + +void tst_QmlAudio::duration() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(durationChanged())); + + QCOMPARE(audio.duration(), 0); + + provider.playerControl()->setDuration(4040); + QCOMPARE(audio.duration(), 4040); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setDuration(-129); + QCOMPARE(audio.duration(), -129); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setDuration(0); + QCOMPARE(audio.duration(), 0); + QCOMPARE(spy.count(), 3); + + // Unnecessary duration changed signals aren't filtered. + provider.playerControl()->setDuration(0); + QCOMPARE(audio.duration(), 0); + QCOMPARE(spy.count(), 4); +} + +void tst_QmlAudio::position() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(positionChanged())); + + QCOMPARE(audio.position(), 0); + + // QDeclarativeAudio won't bound set positions to the duration. A media service may though. + QCOMPARE(audio.duration(), 0); + + audio.setPosition(450); + QCOMPARE(audio.position(), 450); + QCOMPARE(provider.playerControl()->position(), qint64(450)); + QCOMPARE(spy.count(), 1); + + audio.setPosition(-5403); + QCOMPARE(audio.position(), -5403); + QCOMPARE(provider.playerControl()->position(), qint64(-5403)); + QCOMPARE(spy.count(), 2); + + audio.setPosition(-5403); + QCOMPARE(audio.position(), -5403); + QCOMPARE(provider.playerControl()->position(), qint64(-5403)); + QCOMPARE(spy.count(), 3); + + // Check the signal change signal is emitted if the change originates from the media service. + provider.playerControl()->setPosition(0); + QCOMPARE(audio.position(), 0); + QCOMPARE(spy.count(), 4); + + connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + provider.playerControl()->updateState(QMediaPlayer::PlayingState); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(spy.count() > 4 && spy.count() < 7); // 5 or 6 + + provider.playerControl()->updateState(QMediaPlayer::PausedState); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(spy.count() < 7); +} + +void tst_QmlAudio::volume() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(volumeChanged())); + + QCOMPARE(audio.volume(), qreal(0.5)); + + audio.setVolume(0.7); + QCOMPARE(audio.volume(), qreal(0.7)); + QCOMPARE(provider.playerControl()->volume(), 70); + QCOMPARE(spy.count(), 1); + + audio.setVolume(0.7); + QCOMPARE(audio.volume(), qreal(0.7)); + QCOMPARE(provider.playerControl()->volume(), 70); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setVolume(30); + QCOMPARE(audio.volume(), qreal(0.3)); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlAudio::muted() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(mutedChanged())); + + QCOMPARE(audio.isMuted(), false); + + audio.setMuted(true); + QCOMPARE(audio.isMuted(), true); + QCOMPARE(provider.playerControl()->isMuted(), true); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setMuted(false); + QCOMPARE(audio.isMuted(), false); + QCOMPARE(spy.count(), 2); + + audio.setMuted(false); + QCOMPARE(audio.isMuted(), false); + QCOMPARE(provider.playerControl()->isMuted(), false); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlAudio::bufferProgress() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged())); + + QCOMPARE(audio.bufferProgress(), qreal(0.0)); + + provider.playerControl()->setBufferStatus(20); + QCOMPARE(audio.bufferProgress(), qreal(0.2)); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setBufferStatus(20); + QCOMPARE(audio.bufferProgress(), qreal(0.2)); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setBufferStatus(40); + QCOMPARE(audio.bufferProgress(), qreal(0.4)); + QCOMPARE(spy.count(), 3); + + connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop())); + + provider.playerControl()->updateMediaStatus( + QMediaPlayer::BufferingMedia, QMediaPlayer::PlayingState); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5 + + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); + QTestEventLoop::instance().enterLoop(1); + QVERIFY(spy.count() < 6); +} + +void tst_QmlAudio::seekable() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(seekableChanged())); + + QCOMPARE(audio.isSeekable(), false); + + provider.playerControl()->setSeekable(true); + QCOMPARE(audio.isSeekable(), true); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setSeekable(true); + QCOMPARE(audio.isSeekable(), true); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setSeekable(false); + QCOMPARE(audio.isSeekable(), false); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlAudio::playbackRate() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(playbackRateChanged())); + + QCOMPARE(audio.playbackRate(), qreal(1.0)); + + audio.setPlaybackRate(0.5); + QCOMPARE(audio.playbackRate(), qreal(0.5)); + QCOMPARE(provider.playerControl()->playbackRate(), qreal(0.5)); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setPlaybackRate(2.0); + QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0)); + QCOMPARE(spy.count(), 2); + + audio.setPlaybackRate(2.0); + QCOMPARE(audio.playbackRate(), qreal(2.0)); + QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0)); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlAudio::status() +{ + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged())); + QSignalSpy loadedSpy(&audio, SIGNAL(loaded())); + QSignalSpy bufferingSpy(&audio, SIGNAL(buffering())); + QSignalSpy stalledSpy(&audio, SIGNAL(stalled())); + QSignalSpy bufferedSpy(&audio, SIGNAL(buffered())); + QSignalSpy endOfMediaSpy(&audio, SIGNAL(endOfMedia())); + + QCOMPARE(audio.status(), QDeclarativeAudio::NoMedia); + + // Set media, start loading. + provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadingMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Loading); + QCOMPARE(statusChangedSpy.count(), 1); + QCOMPARE(loadedSpy.count(), 0); + QCOMPARE(bufferingSpy.count(), 0); + QCOMPARE(stalledSpy.count(), 0); + QCOMPARE(bufferedSpy.count(), 0); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Finish loading. + provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadedMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Loaded); + QCOMPARE(statusChangedSpy.count(), 2); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 0); + QCOMPARE(stalledSpy.count(), 0); + QCOMPARE(bufferedSpy.count(), 0); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Play, start buffering. + provider.playerControl()->updateMediaStatus( + QMediaPlayer::StalledMedia, QMediaPlayer::PlayingState); + QCOMPARE(audio.status(), QDeclarativeAudio::Stalled); + QCOMPARE(statusChangedSpy.count(), 3); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 0); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 0); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Enough data buffered to proceed. + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Buffering); + QCOMPARE(statusChangedSpy.count(), 4); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 1); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 0); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Errant second buffering status changed. + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Buffering); + QCOMPARE(statusChangedSpy.count(), 4); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 1); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 0); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Buffer full. + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Buffered); + QCOMPARE(statusChangedSpy.count(), 5); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 1); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 1); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Buffer getting low. + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Buffering); + QCOMPARE(statusChangedSpy.count(), 6); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 2); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 1); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Buffer full. + provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); + QCOMPARE(audio.status(), QDeclarativeAudio::Buffered); + QCOMPARE(statusChangedSpy.count(), 7); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 2); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 2); + QCOMPARE(endOfMediaSpy.count(), 0); + + // Finished. + provider.playerControl()->updateMediaStatus( + QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState); + QCOMPARE(audio.status(), QDeclarativeAudio::EndOfMedia); + QCOMPARE(statusChangedSpy.count(), 8); + QCOMPARE(loadedSpy.count(), 1); + QCOMPARE(bufferingSpy.count(), 2); + QCOMPARE(stalledSpy.count(), 1); + QCOMPARE(bufferedSpy.count(), 2); + QCOMPARE(endOfMediaSpy.count(), 1); +} + +void tst_QmlAudio::metaData_data() +{ + QTest::addColumn<QByteArray>("propertyName"); + QTest::addColumn<QtMultimedia::MetaData>("propertyKey"); + QTest::addColumn<QVariant>("value1"); + QTest::addColumn<QVariant>("value2"); + + QTest::newRow("title") + << QByteArray("title") + << QtMultimedia::Title + << QVariant(QString::fromLatin1("This is a title")) + << QVariant(QString::fromLatin1("This is another title")); + + QTest::newRow("genre") + << QByteArray("genre") + << QtMultimedia::Genre + << QVariant(QString::fromLatin1("rock")) + << QVariant(QString::fromLatin1("pop")); + + QTest::newRow("trackNumber") + << QByteArray("trackNumber") + << QtMultimedia::TrackNumber + << QVariant(8) + << QVariant(12); +} + +void tst_QmlAudio::metaData() +{ + QFETCH(QByteArray, propertyName); + QFETCH(QtMultimedia::MetaData, propertyKey); + QFETCH(QVariant, value1); + QFETCH(QVariant, value2); + + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy spy(&audio, SIGNAL(__metaDataChanged())); + + const int index = audio.metaObject()->indexOfProperty(propertyName.constData()); + QVERIFY(index != -1); + + QMetaProperty property = audio.metaObject()->property(index); + QCOMPARE(property.read(&audio), QVariant()); + + property.write(&audio, value1); + QCOMPARE(property.read(&audio), value1); + QCOMPARE(provider.metaDataControl()->metaData(propertyKey), value1); + QCOMPARE(spy.count(), 1); + + provider.metaDataControl()->setMetaData(propertyKey, value2); + QCOMPARE(property.read(&audio), value2); + QCOMPARE(spy.count(), 2); +} + +void tst_QmlAudio::error() +{ + const QString errorString = QLatin1String("Failed to open device."); + + QtTestMediaServiceProvider provider; + QDeclarativeAudio audio; + + QSignalSpy errorSpy(&audio, SIGNAL(error(QDeclarativeAudio::Error,QString))); + QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged())); + + QCOMPARE(audio.error(), QDeclarativeAudio::NoError); + QCOMPARE(audio.errorString(), QString()); + + provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString); + + QCOMPARE(audio.error(), QDeclarativeAudio::ResourceError); + QCOMPARE(audio.errorString(), errorString); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 1); + + // Changing the source resets the error properties. + audio.setSource(QUrl("http://example.com")); + QCOMPARE(audio.error(), QDeclarativeAudio::NoError); + QCOMPARE(audio.errorString(), QString()); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 2); + + // But isn't noisy. + audio.setSource(QUrl("file:///file/path")); + QCOMPARE(audio.error(), QDeclarativeAudio::NoError); + QCOMPARE(audio.errorString(), QString()); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 2); +} + + +QTEST_MAIN(tst_QmlAudio) + +#include "tst_qdeclarativeaudio.moc" diff --git a/tests/auto/qdeclarativevideo/qdeclarativevideo.pro b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro new file mode 100644 index 0000000..d946bb0 --- /dev/null +++ b/tests/auto/qdeclarativevideo/qdeclarativevideo.pro @@ -0,0 +1,4 @@ +load(qttest_p4) +SOURCES += tst_qdeclarativevideo.cpp + +QT += multimedia declarative diff --git a/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp new file mode 100644 index 0000000..9fc1e70 --- /dev/null +++ b/tests/auto/qdeclarativevideo/tst_qdeclarativevideo.cpp @@ -0,0 +1,911 @@ +/**************************************************************************** +** +** 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 <QtTest/QtTest> + +#include <QtMultimedia/private/qdeclarativevideo_p.h> + +#include <QtGui/qapplication.h> +#include <QtMultimedia/qabstractvideosurface.h> +#include <QtMultimedia/qgraphicsvideoitem.h> +#include <QtMultimedia/qmediaplayercontrol.h> +#include <QtMultimedia/qmediaservice.h> +#include <QtMultimedia/qvideooutputcontrol.h> +#include <QtMultimedia/qvideorenderercontrol.h> +#include <QtMultimedia/qvideosurfaceformat.h> + + +class tst_QmlGraphicsVideo : public QObject +{ + Q_OBJECT +public slots: + void initTestCase(); + +private slots: + void nullPlayerControl(); + void nullService(); + + void playing(); + void paused(); + void error(); + + void hasAudio(); + void hasVideo(); + void fillMode(); + void geometry(); +}; + +Q_DECLARE_METATYPE(QtMultimedia::MetaData); +Q_DECLARE_METATYPE(QDeclarativeVideo::Error); + +class QtTestMediaPlayerControl : public QMediaPlayerControl +{ + Q_OBJECT +public: + QtTestMediaPlayerControl(QObject *parent = 0) + : QMediaPlayerControl(parent) + , m_state(QMediaPlayer::StoppedState) + , m_mediaStatus(QMediaPlayer::NoMedia) + , m_duration(0) + , m_position(0) + , m_playbackRate(1.0) + , m_volume(50) + , m_bufferStatus(0) + , m_muted(false) + , m_audioAvailable(false) + , m_videoAvailable(false) + , m_seekable(false) + { + } + + QMediaPlayer::State state() const { return m_state; } + void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); } + + QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; } + void updateMediaStatus(QMediaPlayer::MediaStatus status) { + emit mediaStatusChanged(m_mediaStatus = status); } + void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state) + { + m_mediaStatus = status; + m_state = state; + + emit mediaStatusChanged(m_mediaStatus); + emit stateChanged(m_state); + } + + qint64 duration() const { return m_duration; } + void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); } + + qint64 position() const { return m_position; } + void setPosition(qint64 position) { emit positionChanged(m_position = position); } + + int volume() const { return m_volume; } + void setVolume(int volume) { emit volumeChanged(m_volume = volume); } + + bool isMuted() const { return m_muted; } + void setMuted(bool muted) { emit mutedChanged(m_muted = muted); } + + int bufferStatus() const { return m_bufferStatus; } + void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); } + + bool isAudioAvailable() const { return m_audioAvailable; } + void setAudioAvailable(bool available) { + emit audioAvailableChanged(m_audioAvailable = available); } + bool isVideoAvailable() const { return m_videoAvailable; } + void setVideoAvailable(bool available) { + emit videoAvailableChanged(m_videoAvailable = available); } + + bool isSeekable() const { return m_seekable; } + void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); } + + QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } + + qreal playbackRate() const { return m_playbackRate; } + void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); } + + QMediaContent media() const { return m_media; } + const QIODevice *mediaStream() const { return 0; } + void setMedia(const QMediaContent &media, QIODevice *) + { + m_media = media; + + m_mediaStatus = m_media.isNull() + ? QMediaPlayer::NoMedia + : QMediaPlayer::LoadingMedia; + + emit mediaChanged(m_media); + emit mediaStatusChanged(m_mediaStatus); + } + + void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); } + void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); } + void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); } + + void emitError(QMediaPlayer::Error err, const QString &errorString) { + emit error(err, errorString); } + +private: + QMediaPlayer::State m_state; + QMediaPlayer::MediaStatus m_mediaStatus; + qint64 m_duration; + qint64 m_position; + qreal m_playbackRate; + int m_volume; + int m_bufferStatus; + bool m_muted; + bool m_audioAvailable; + bool m_videoAvailable; + bool m_seekable; + QMediaContent m_media; +}; + +class QtTestOutputControl : public QVideoOutputControl +{ +public: + QtTestOutputControl(QObject *parent) : QVideoOutputControl(parent), m_output(NoOutput) {} + + QList<Output> availableOutputs() const { return m_outputs; } + void setAvailableOutputs(const QList<Output> outputs) { m_outputs = outputs; } + + Output output() const { return m_output; } + virtual void setOutput(Output output) { m_output = output; } + +private: + Output m_output; + QList<Output> m_outputs; +}; + +class QtTestRendererControl : public QVideoRendererControl +{ +public: + QtTestRendererControl(QObject *parent ) : QVideoRendererControl(parent), m_surface(0) {} + + QAbstractVideoSurface *surface() const { return m_surface; } + void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; } + +private: + QAbstractVideoSurface *m_surface; +}; + +class QtTestMediaService : public QMediaService +{ + Q_OBJECT +public: + QtTestMediaService( + QtTestMediaPlayerControl *playerControl, + QtTestOutputControl *outputControl, + QtTestRendererControl *rendererControl, + QObject *parent) + : QMediaService(parent) + , playerControl(playerControl) + , outputControl(outputControl) + , rendererControl(rendererControl) + { + } + + QMediaControl *control(const char *name) const + { + if (qstrcmp(name, QMediaPlayerControl_iid) == 0) + return playerControl; + else if (qstrcmp(name, QVideoOutputControl_iid) == 0) + return outputControl; + else if (qstrcmp(name, QVideoRendererControl_iid) == 0) + return rendererControl; + else + return 0; + } + + QtTestMediaPlayerControl *playerControl; + QtTestOutputControl *outputControl; + QtTestRendererControl *rendererControl; +}; + +class QtTestMediaServiceProvider : public QMediaServiceProvider +{ + Q_OBJECT +public: + QtTestMediaServiceProvider() + : service(new QtTestMediaService( + new QtTestMediaPlayerControl(this), + new QtTestOutputControl(this), + new QtTestRendererControl(this), + this)) + { + setDefaultServiceProvider(this); + } + + QtTestMediaServiceProvider(QtTestMediaService *service) + : service(service) + { + setDefaultServiceProvider(this); + } + + QtTestMediaServiceProvider( + QtTestMediaPlayerControl *playerControl, + QtTestOutputControl *outputControl, + QtTestRendererControl *rendererControl) + : service(new QtTestMediaService(playerControl, outputControl, rendererControl, this)) + { + setDefaultServiceProvider(this); + } + + ~QtTestMediaServiceProvider() + { + setDefaultServiceProvider(0); + } + + QMediaService *requestService( + const QByteArray &type, + const QMediaServiceProviderHint & = QMediaServiceProviderHint()) + { + requestedService = type; + + return service; + } + + void releaseService(QMediaService *) {} + + inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; } + inline QtTestRendererControl *rendererControl() { return service->rendererControl; } + + QtTestMediaService *service; + QByteArray requestedService; +}; + + +void tst_QmlGraphicsVideo::initTestCase() +{ + qRegisterMetaType<QDeclarativeVideo::Error>(); +} + +void tst_QmlGraphicsVideo::nullPlayerControl() +{ + QtTestMediaServiceProvider provider(0, 0, 0); + + QDeclarativeVideo video; + + QCOMPARE(video.source(), QUrl()); + video.setSource(QUrl("http://example.com")); + QCOMPARE(video.source(), QUrl()); + + QCOMPARE(video.isPlaying(), false); + video.setPlaying(true); + QCOMPARE(video.isPlaying(), false); + video.play(); + QCOMPARE(video.isPlaying(), false); + + QCOMPARE(video.isPaused(), false); + video.pause(); + QCOMPARE(video.isPaused(), false); + video.setPaused(true); + QCOMPARE(video.isPaused(), true); + + QCOMPARE(video.duration(), 0); + + QCOMPARE(video.position(), 0); + video.setPosition(10000); + QCOMPARE(video.position(), 0); + + QCOMPARE(video.volume(), qreal(0)); + video.setVolume(50); + QCOMPARE(video.volume(), qreal(0)); + + QCOMPARE(video.isMuted(), false); + video.setMuted(true); + QCOMPARE(video.isMuted(), false); + + QCOMPARE(video.bufferProgress(), qreal(0)); + + QCOMPARE(video.isSeekable(), false); + + QCOMPARE(video.playbackRate(), qreal(1.0)); + + QCOMPARE(video.hasAudio(), false); + QCOMPARE(video.hasVideo(), false); + + QCOMPARE(video.status(), QDeclarativeVideo::NoMedia); + + QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing); +} + +void tst_QmlGraphicsVideo::nullService() +{ + QtTestMediaServiceProvider provider(0); + + QDeclarativeVideo video; + + QCOMPARE(video.source(), QUrl()); + video.setSource(QUrl("http://example.com")); + QCOMPARE(video.source(), QUrl()); + + QCOMPARE(video.isPlaying(), false); + video.setPlaying(true); + QCOMPARE(video.isPlaying(), false); + video.play(); + QCOMPARE(video.isPlaying(), false); + + QCOMPARE(video.isPaused(), false); + video.pause(); + QCOMPARE(video.isPaused(), false); + video.setPaused(true); + QCOMPARE(video.isPaused(), true); + + QCOMPARE(video.duration(), 0); + + QCOMPARE(video.position(), 0); + video.setPosition(10000); + QCOMPARE(video.position(), 0); + + QCOMPARE(video.volume(), qreal(0)); + video.setVolume(50); + QCOMPARE(video.volume(), qreal(0)); + + QCOMPARE(video.isMuted(), false); + video.setMuted(true); + QCOMPARE(video.isMuted(), false); + + QCOMPARE(video.bufferProgress(), qreal(0)); + + QCOMPARE(video.isSeekable(), false); + + QCOMPARE(video.playbackRate(), qreal(1.0)); + + QCOMPARE(video.hasAudio(), false); + QCOMPARE(video.hasVideo(), false); + + QCOMPARE(video.status(), QDeclarativeVideo::NoMedia); + + QCOMPARE(video.error(), QDeclarativeVideo::ServiceMissing); + + QCOMPARE(video.metaObject()->indexOfProperty("title"), -1); + QCOMPARE(video.metaObject()->indexOfProperty("genre"), -1); + QCOMPARE(video.metaObject()->indexOfProperty("description"), -1); +} + +void tst_QmlGraphicsVideo::playing() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); + QSignalSpy startedSpy(&video, SIGNAL(started())); + QSignalSpy stoppedSpy(&video, SIGNAL(stopped())); + + int playingChanged = 0; + int started = 0; + int stopped = 0; + + QCOMPARE(video.isPlaying(), false); + + // setPlaying(true) when stopped. + video.setPlaying(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when playing. + video.setPlaying(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // play() when stopped. + video.play(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when playing. + video.stop(); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // stop() when stopped. + video.stop(); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when stopped. + video.setPlaying(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + video.setPlaying(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(true) when playing. + video.setPlaying(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); + + // play() when playing. + video.play(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(stoppedSpy.count(), stopped); +} + +void tst_QmlGraphicsVideo::paused() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); + QSignalSpy pausedChangedSpy(&video, SIGNAL(pausedChanged())); + QSignalSpy startedSpy(&video, SIGNAL(started())); + QSignalSpy pausedSpy(&video, SIGNAL(paused())); + QSignalSpy resumedSpy(&video, SIGNAL(resumed())); + QSignalSpy stoppedSpy(&video, SIGNAL(stopped())); + + int playingChanged = 0; + int pausedChanged = 0; + int started = 0; + int paused = 0; + int resumed = 0; + int stopped = 0; + + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), false); + + // setPlaying(true) when stopped. + video.setPlaying(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when playing. + video.setPaused(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when paused. + video.setPaused(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when paused. + video.pause(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when paused. + video.setPaused(false); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), ++resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when playing. + video.setPaused(false); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when playing. + video.pause(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + video.setPlaying(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // setPaused(true) when stopped and paused. + video.setPaused(true); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(false) when stopped and paused. + video.setPaused(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when stopped. + video.setPaused(true); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(true) when stopped and paused. + video.setPlaying(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // play() when paused. + video.play(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), ++resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPaused(true) when playing. + video.setPaused(true); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when paused. + video.stop(); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // setPaused(true) when stopped. + video.setPaused(true); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // stop() when stopped and paused. + video.stop(); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // pause() when stopped. + video.pause(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + video.setPlaying(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // pause() when stopped and paused. + video.pause(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), ++paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); + + // setPlaying(false) when paused. + video.setPlaying(false); + QCOMPARE(video.isPlaying(), false); + QCOMPARE(video.isPaused(), true); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), pausedChanged); + QCOMPARE(startedSpy.count(), started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), ++stopped); + + // play() when stopped and paused. + video.play(); + QCOMPARE(video.isPlaying(), true); + QCOMPARE(video.isPaused(), false); + QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); + QCOMPARE(playingChangedSpy.count(), ++playingChanged); + QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); + QCOMPARE(startedSpy.count(), ++started); + QCOMPARE(pausedSpy.count(), paused); + QCOMPARE(resumedSpy.count(), resumed); + QCOMPARE(stoppedSpy.count(), stopped); +} + +void tst_QmlGraphicsVideo::error() +{ + const QString errorString = QLatin1String("Failed to open device."); + + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QSignalSpy errorSpy(&video, SIGNAL(error(QDeclarativeVideo::Error,QString))); + QSignalSpy errorChangedSpy(&video, SIGNAL(errorChanged())); + + QCOMPARE(video.error(), QDeclarativeVideo::NoError); + QCOMPARE(video.errorString(), QString()); + + provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString); + + QCOMPARE(video.error(), QDeclarativeVideo::ResourceError); + QCOMPARE(video.errorString(), errorString); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 1); + + // Changing the source resets the error properties. + video.setSource(QUrl("http://example.com")); + QCOMPARE(video.error(), QDeclarativeVideo::NoError); + QCOMPARE(video.errorString(), QString()); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 2); + + // But isn't noisy. + video.setSource(QUrl("file:///file/path")); + QCOMPARE(video.error(), QDeclarativeVideo::NoError); + QCOMPARE(video.errorString(), QString()); + QCOMPARE(errorSpy.count(), 1); + QCOMPARE(errorChangedSpy.count(), 2); +} + + +void tst_QmlGraphicsVideo::hasAudio() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QSignalSpy spy(&video, SIGNAL(hasAudioChanged())); + + QCOMPARE(video.hasAudio(), false); + + provider.playerControl()->setAudioAvailable(true); + QCOMPARE(video.hasAudio(), true); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setAudioAvailable(true); + QCOMPARE(video.hasAudio(), true); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setAudioAvailable(false); + QCOMPARE(video.hasAudio(), false); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlGraphicsVideo::hasVideo() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QSignalSpy spy(&video, SIGNAL(hasVideoChanged())); + + QCOMPARE(video.hasVideo(), false); + + provider.playerControl()->setVideoAvailable(true); + QCOMPARE(video.hasVideo(), true); + QCOMPARE(spy.count(), 1); + + provider.playerControl()->setVideoAvailable(true); + QCOMPARE(video.hasVideo(), true); + QCOMPARE(spy.count(), 2); + + provider.playerControl()->setVideoAvailable(false); + QCOMPARE(video.hasVideo(), false); + QCOMPARE(spy.count(), 3); +} + +void tst_QmlGraphicsVideo::fillMode() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QList<QGraphicsItem *> children = video.childItems(); + QCOMPARE(children.count(), 1); + QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first()); + QVERIFY(videoItem != 0); + + QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit); + + video.setFillMode(QDeclarativeVideo::PreserveAspectCrop); + QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectCrop); + QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatioByExpanding); + + video.setFillMode(QDeclarativeVideo::Stretch); + QCOMPARE(video.fillMode(), QDeclarativeVideo::Stretch); + QCOMPARE(videoItem->aspectRatioMode(), Qt::IgnoreAspectRatio); + + video.setFillMode(QDeclarativeVideo::PreserveAspectFit); + QCOMPARE(video.fillMode(), QDeclarativeVideo::PreserveAspectFit); + QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatio); +} + +void tst_QmlGraphicsVideo::geometry() +{ + QtTestMediaServiceProvider provider; + QDeclarativeVideo video; + + QAbstractVideoSurface *surface = provider.rendererControl()->surface(); + QVERIFY(surface != 0); + + QList<QGraphicsItem *> children = video.childItems(); + QCOMPARE(children.count(), 1); + QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first()); + QVERIFY(videoItem != 0); + + QVideoSurfaceFormat format(QSize(640, 480), QVideoFrame::Format_RGB32); + + QVERIFY(surface->start(format)); + + QCOMPARE(video.implicitWidth(), qreal(640)); + QCOMPARE(video.implicitHeight(), qreal(480)); + + video.setWidth(560); + video.setHeight(328); + + QCOMPARE(videoItem->size().width(), qreal(560)); + QCOMPARE(videoItem->size().height(), qreal(328)); +} + +QTEST_MAIN(tst_QmlGraphicsVideo) + +#include "tst_qdeclarativevideo.moc" diff --git a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp index 12ddff1..124f900 100644 --- a/tests/auto/qeasingcurve/tst_qeasingcurve.cpp +++ b/tests/auto/qeasingcurve/tst_qeasingcurve.cpp @@ -69,6 +69,8 @@ private slots: void valueForProgress(); void setCustomType(); void operators(); + void properties(); + void metaTypes(); protected: }; @@ -505,6 +507,65 @@ void tst_QEasingCurve::operators() QVERIFY(curve2 == curve); } +class tst_QEasingProperties : public QObject +{ + Q_OBJECT + Q_PROPERTY(QEasingCurve easing READ easing WRITE setEasing) +public: + tst_QEasingProperties(QObject *parent = 0) : QObject(parent) {} + + QEasingCurve easing() const { return e; } + void setEasing(const QEasingCurve& value) { e = value; } + +private: + QEasingCurve e; +}; + +// Test getting and setting easing properties via the metaobject system. +void tst_QEasingCurve::properties() +{ + tst_QEasingProperties obj; + + QEasingCurve inOutBack(QEasingCurve::InOutBack); + qreal overshoot = 1.5f; + inOutBack.setOvershoot(overshoot); + qreal amplitude = inOutBack.amplitude(); + qreal period = inOutBack.period(); + + obj.setEasing(inOutBack); + + QEasingCurve easing = qVariantValue<QEasingCurve>(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::InOutBack); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); + + QEasingCurve linear(QEasingCurve::Linear); + overshoot = linear.overshoot(); + amplitude = linear.amplitude(); + period = linear.period(); + + obj.setProperty("easing", + qVariantFromValue(QEasingCurve(QEasingCurve::Linear))); + + easing = qVariantValue<QEasingCurve>(obj.property("easing")); + QCOMPARE(easing.type(), QEasingCurve::Linear); + QCOMPARE(easing.overshoot(), overshoot); + QCOMPARE(easing.amplitude(), amplitude); + QCOMPARE(easing.period(), period); +} + +void tst_QEasingCurve::metaTypes() +{ + QVERIFY(QMetaType::type("QEasingCurve") == QMetaType::QEasingCurve); + + QCOMPARE(QByteArray(QMetaType::typeName(QMetaType::QEasingCurve)), + QByteArray("QEasingCurve")); + + QVERIFY(QMetaType::isRegistered(QMetaType::QEasingCurve)); + + QVERIFY(qMetaTypeId<QEasingCurve>() == QMetaType::QEasingCurve); +} QTEST_MAIN(tst_QEasingCurve) #include "tst_qeasingcurve.moc" diff --git a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp index 2ef0419..d37ff76 100644 --- a/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp +++ b/tests/auto/qgraphicsscene/tst_qgraphicsscene.cpp @@ -245,6 +245,7 @@ private slots: #endif void render_data(); void render(); + void renderItemsWithNegativeWidthOrHeight(); void contextMenuEvent(); void contextMenuEvent_ItemIgnoresTransformations(); void update(); @@ -2751,6 +2752,41 @@ void tst_QGraphicsScene::render() } } +void tst_QGraphicsScene::renderItemsWithNegativeWidthOrHeight() +{ + QGraphicsScene scene(0, 0, 150, 150); + + // Add item with negative width. + QGraphicsRectItem *item1 = new QGraphicsRectItem(0, 0, -150, 50); + item1->setBrush(Qt::red); + item1->setPos(150, 50); + scene.addItem(item1); + + // Add item with negative height. + QGraphicsRectItem *item2 = new QGraphicsRectItem(0, 0, 50, -150); + item2->setBrush(Qt::blue); + item2->setPos(50, 150); + scene.addItem(item2); + + QGraphicsView view(&scene); + view.setFrameStyle(QFrame::NoFrame); + view.resize(150, 150); + view.show(); + QCOMPARE(view.viewport()->size(), QSize(150, 150)); + + QImage expected(view.viewport()->size(), QImage::Format_RGB32); + view.viewport()->render(&expected); + + // Make sure the scene background is the same as the viewport background. + scene.setBackgroundBrush(view.viewport()->palette().brush(view.viewport()->backgroundRole())); + QImage actual(150, 150, QImage::Format_RGB32); + QPainter painter(&actual); + scene.render(&painter); + painter.end(); + + QCOMPARE(actual, expected); +} + void tst_QGraphicsScene::contextMenuEvent() { QGraphicsScene scene; diff --git a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp index 59bffeb..c77f76d 100644 --- a/tests/auto/qgraphicsview/tst_qgraphicsview.cpp +++ b/tests/auto/qgraphicsview/tst_qgraphicsview.cpp @@ -218,6 +218,7 @@ private slots: void update(); void inputMethodSensitivity(); void inputContextReset(); + void indirectPainting(); // task specific tests below me void task172231_untransformableItems(); @@ -3799,6 +3800,31 @@ void tst_QGraphicsView::inputContextReset() QCOMPARE(inputContext.resets, 0); } +void tst_QGraphicsView::indirectPainting() +{ + class MyScene : public QGraphicsScene + { public: + MyScene() : QGraphicsScene(), drawCount(0) {} + void drawItems(QPainter *, int, QGraphicsItem **, const QStyleOptionGraphicsItem *, QWidget *) + { ++drawCount; } + int drawCount; + }; + + MyScene scene; + QGraphicsItem *item = scene.addRect(0, 0, 50, 50); + + QGraphicsView view(&scene); + view.setOptimizationFlag(QGraphicsView::IndirectPainting); + view.show(); + QTest::qWaitForWindowShown(&view); + QTest::qWait(100); + + scene.drawCount = 0; + item->setPos(20, 20); + QApplication::processEvents(); + QTRY_VERIFY(scene.drawCount > 0); +} + void tst_QGraphicsView::task253415_reconnectUpdateSceneOnSceneChanged() { QGraphicsView view; diff --git a/tests/auto/qmlaudio/qmlaudio.pro b/tests/auto/qmlaudio/qmlaudio.pro deleted file mode 100644 index fe18761..0000000 --- a/tests/auto/qmlaudio/qmlaudio.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qmlaudio.cpp - -QT += multimedia declarative -requires(contains(QT_CONFIG, multimedia)) -requires(contains(QT_CONFIG, declarative)) diff --git a/tests/auto/qmlaudio/tst_qmlaudio.cpp b/tests/auto/qmlaudio/tst_qmlaudio.cpp deleted file mode 100644 index 068317f..0000000 --- a/tests/auto/qmlaudio/tst_qmlaudio.cpp +++ /dev/null @@ -1,1200 +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 <QtTest/QtTest> - -#include <QtMultimedia/private/qmlaudio_p.h> - -#include <QtGui/qapplication.h> -#include <QtMultimedia/qmediaplayercontrol.h> -#include <QtMultimedia/qmediaservice.h> -#include <QtMultimedia/qmetadatacontrol.h> - - -class tst_QmlAudio : public QObject -{ - Q_OBJECT -public slots: - void initTestCase(); - -private slots: - void nullPlayerControl(); - void nullMetaDataControl(); - void nullService(); - - void source(); - void playing(); - void paused(); - void duration(); - void position(); - void volume(); - void muted(); - void bufferProgress(); - void seekable(); - void playbackRate(); - void status(); - void metaData_data(); - void metaData(); - void error(); -}; - -Q_DECLARE_METATYPE(QtMultimedia::MetaData); -Q_DECLARE_METATYPE(QmlAudio::Error); - -class QtTestMediaPlayerControl : public QMediaPlayerControl -{ - Q_OBJECT -public: - QtTestMediaPlayerControl(QObject *parent = 0) - : QMediaPlayerControl(parent) - , m_state(QMediaPlayer::StoppedState) - , m_mediaStatus(QMediaPlayer::NoMedia) - , m_duration(0) - , m_position(0) - , m_playbackRate(1.0) - , m_volume(50) - , m_bufferStatus(0) - , m_muted(false) - , m_audioAvailable(false) - , m_videoAvailable(false) - , m_seekable(false) - { - } - - QMediaPlayer::State state() const { return m_state; } - void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); } - - QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; } - void updateMediaStatus(QMediaPlayer::MediaStatus status) { - emit mediaStatusChanged(m_mediaStatus = status); } - void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state) - { - m_mediaStatus = status; - m_state = state; - - emit mediaStatusChanged(m_mediaStatus); - emit stateChanged(m_state); - } - - qint64 duration() const { return m_duration; } - void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); } - - qint64 position() const { return m_position; } - void setPosition(qint64 position) { emit positionChanged(m_position = position); } - - int volume() const { return m_volume; } - void setVolume(int volume) { emit volumeChanged(m_volume = volume); } - - bool isMuted() const { return m_muted; } - void setMuted(bool muted) { emit mutedChanged(m_muted = muted); } - - int bufferStatus() const { return m_bufferStatus; } - void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); } - - bool isAudioAvailable() const { return m_audioAvailable; } - void setAudioAvailable(bool available) { - emit audioAvailableChanged(m_audioAvailable = available); } - bool isVideoAvailable() const { return m_videoAvailable; } - void setVideoAvailable(bool available) { - emit videoAvailableChanged(m_videoAvailable = available); } - - bool isSeekable() const { return m_seekable; } - void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); } - - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } - - qreal playbackRate() const { return m_playbackRate; } - void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); } - - QMediaContent media() const { return m_media; } - const QIODevice *mediaStream() const { return 0; } - void setMedia(const QMediaContent &media, QIODevice *) - { - m_media = media; - - m_mediaStatus = m_media.isNull() - ? QMediaPlayer::NoMedia - : QMediaPlayer::LoadingMedia; - - emit mediaChanged(m_media); - emit mediaStatusChanged(m_mediaStatus); - } - - void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); } - void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); } - void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); } - - void emitError(QMediaPlayer::Error err, const QString &errorString) { - emit error(err, errorString); } - -private: - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_mediaStatus; - qint64 m_duration; - qint64 m_position; - qreal m_playbackRate; - int m_volume; - int m_bufferStatus; - bool m_muted; - bool m_audioAvailable; - bool m_videoAvailable; - bool m_seekable; - QMediaContent m_media; -}; - -class QtTestMetaDataControl : public QMetaDataControl -{ - Q_OBJECT -public: - QtTestMetaDataControl(QObject *parent = 0) - : QMetaDataControl(parent) - { - } - - bool isWritable() const { return true; } - bool isMetaDataAvailable() const { return true; } - - QVariant metaData(QtMultimedia::MetaData key) const { return m_metaData.value(key); } - void setMetaData(QtMultimedia::MetaData key, const QVariant &value) { - m_metaData.insert(key, value); emit metaDataChanged(); } - void setMetaData(const QMap<QtMultimedia::MetaData, QVariant> &metaData) { - m_metaData = metaData; emit metaDataChanged(); } - - QList<QtMultimedia::MetaData> availableMetaData() const { return m_metaData.keys(); } - - QVariant extendedMetaData(const QString &) const { return QVariant(); } - void setExtendedMetaData(const QString &, const QVariant &) {} - QStringList availableExtendedMetaData() const { return QStringList(); } - -private: - QMap<QtMultimedia::MetaData, QVariant> m_metaData; -}; - -class QtTestMediaService : public QMediaService -{ - Q_OBJECT -public: - QtTestMediaService( - QtTestMediaPlayerControl *playerControl, - QtTestMetaDataControl *metaDataControl, - QObject *parent) - : QMediaService(parent) - , playerControl(playerControl) - , metaDataControl(metaDataControl) - { - } - - QMediaControl *control(const char *name) const - { - if (qstrcmp(name, QMediaPlayerControl_iid) == 0) - return playerControl; - else if (qstrcmp(name, QMetaDataControl_iid) == 0) - return metaDataControl; - else - return 0; - } - - QtTestMediaPlayerControl *playerControl; - QtTestMetaDataControl *metaDataControl; -}; - -class QtTestMediaServiceProvider : public QMediaServiceProvider -{ - Q_OBJECT -public: - QtTestMediaServiceProvider() - : service(new QtTestMediaService( - new QtTestMediaPlayerControl(this), new QtTestMetaDataControl(this), this)) - { - setDefaultServiceProvider(this); - } - - QtTestMediaServiceProvider(QtTestMediaService *service) - : service(service) - { - setDefaultServiceProvider(this); - } - - QtTestMediaServiceProvider( - QtTestMediaPlayerControl *playerControl, QtTestMetaDataControl *metaDataControl) - : service(new QtTestMediaService(playerControl, metaDataControl, this)) - { - setDefaultServiceProvider(this); - } - - ~QtTestMediaServiceProvider() - { - setDefaultServiceProvider(0); - } - - QMediaService *requestService( - const QByteArray &type, - const QMediaServiceProviderHint & = QMediaServiceProviderHint()) - { - requestedService = type; - - return service; - } - - void releaseService(QMediaService *) {} - - inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; } - inline QtTestMetaDataControl *metaDataControl() { return service->metaDataControl; } - - QtTestMediaService *service; - QByteArray requestedService; -}; - - -void tst_QmlAudio::initTestCase() -{ - qRegisterMetaType<QmlAudio::Error>(); -} - -void tst_QmlAudio::nullPlayerControl() -{ - QtTestMetaDataControl metaDataControl; - QtTestMediaServiceProvider provider(0, &metaDataControl); - - QmlAudio audio; - - QCOMPARE(audio.source(), QUrl()); - audio.setSource(QUrl("http://example.com")); - QCOMPARE(audio.source(), QUrl()); - - QCOMPARE(audio.isPlaying(), false); - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), false); - audio.play(); - QCOMPARE(audio.isPlaying(), false); - - QCOMPARE(audio.isPaused(), false); - audio.pause(); - QCOMPARE(audio.isPaused(), false); - audio.setPaused(true); - QCOMPARE(audio.isPaused(), true); - - QCOMPARE(audio.duration(), 0); - - QCOMPARE(audio.position(), 0); - audio.setPosition(10000); - QCOMPARE(audio.position(), 0); - - QCOMPARE(audio.volume(), qreal(0)); - audio.setVolume(50); - QCOMPARE(audio.volume(), qreal(0)); - - QCOMPARE(audio.isMuted(), false); - audio.setMuted(true); - QCOMPARE(audio.isMuted(), false); - - QCOMPARE(audio.bufferProgress(), qreal(0)); - - QCOMPARE(audio.isSeekable(), false); - - QCOMPARE(audio.playbackRate(), qreal(1.0)); - - QCOMPARE(audio.status(), QmlAudio::NoMedia); - - QCOMPARE(audio.error(), QmlAudio::ServiceMissing); -} - -void tst_QmlAudio::nullMetaDataControl() -{ - QtTestMediaPlayerControl playerControl; - QtTestMediaServiceProvider provider(&playerControl, 0); - - QmlAudio audio; - - QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1); - QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1); - QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); -} - -void tst_QmlAudio::nullService() -{ - QtTestMediaServiceProvider provider(0); - - QmlAudio audio; - - QCOMPARE(audio.source(), QUrl()); - audio.setSource(QUrl("http://example.com")); - QCOMPARE(audio.source(), QUrl()); - - QCOMPARE(audio.isPlaying(), false); - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), false); - audio.play(); - QCOMPARE(audio.isPlaying(), false); - - QCOMPARE(audio.isPaused(), false); - audio.pause(); - QCOMPARE(audio.isPaused(), false); - audio.setPaused(true); - QCOMPARE(audio.isPaused(), true); - - QCOMPARE(audio.duration(), 0); - - QCOMPARE(audio.position(), 0); - audio.setPosition(10000); - QCOMPARE(audio.position(), 0); - - QCOMPARE(audio.volume(), qreal(0)); - audio.setVolume(50); - QCOMPARE(audio.volume(), qreal(0)); - - QCOMPARE(audio.isMuted(), false); - audio.setMuted(true); - QCOMPARE(audio.isMuted(), false); - - QCOMPARE(audio.bufferProgress(), qreal(0)); - - QCOMPARE(audio.isSeekable(), false); - - QCOMPARE(audio.playbackRate(), qreal(1.0)); - - QCOMPARE(audio.status(), QmlAudio::NoMedia); - - QCOMPARE(audio.error(), QmlAudio::ServiceMissing); - - QCOMPARE(audio.metaObject()->indexOfProperty("title"), -1); - QCOMPARE(audio.metaObject()->indexOfProperty("genre"), -1); - QCOMPARE(audio.metaObject()->indexOfProperty("description"), -1); -} - -void tst_QmlAudio::source() -{ - const QUrl url1("http://example.com"); - const QUrl url2("file:///local/path"); - const QUrl url3; - - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(sourceChanged())); - - audio.setSource(url1); - QCOMPARE(audio.source(), url1); - QCOMPARE(provider.playerControl()->media().canonicalUrl(), url1); - QCOMPARE(spy.count(), 1); - - audio.setSource(url2); - QCOMPARE(audio.source(), url2); - QCOMPARE(provider.playerControl()->media().canonicalUrl(), url2); - QCOMPARE(spy.count(), 2); - - audio.setSource(url3); - QCOMPARE(audio.source(), url3); - QCOMPARE(provider.playerControl()->media().canonicalUrl(), url3); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlAudio::playing() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged())); - QSignalSpy startedSpy(&audio, SIGNAL(started())); - QSignalSpy stoppedSpy(&audio, SIGNAL(stopped())); - - int playingChanged = 0; - int started = 0; - int stopped = 0; - - QCOMPARE(audio.isPlaying(), false); - - // setPlaying(true) when stopped. - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when playing. - audio.setPlaying(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // play() when stopped. - audio.play(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when playing. - audio.stop(); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // stop() when stopped. - audio.stop(); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when stopped. - audio.setPlaying(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(true) when playing. - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - // play() when playing. - audio.play(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); -} - -void tst_QmlAudio::paused() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy playingChangedSpy(&audio, SIGNAL(playingChanged())); - QSignalSpy pausedChangedSpy(&audio, SIGNAL(pausedChanged())); - QSignalSpy startedSpy(&audio, SIGNAL(started())); - QSignalSpy pausedSpy(&audio, SIGNAL(paused())); - QSignalSpy resumedSpy(&audio, SIGNAL(resumed())); - QSignalSpy stoppedSpy(&audio, SIGNAL(stopped())); - - int playingChanged = 0; - int pausedChanged = 0; - int started = 0; - int paused = 0; - int resumed = 0; - int stopped = 0; - - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), false); - - // setPlaying(true) when stopped. - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when playing. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when paused. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when paused. - audio.pause(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when paused. - audio.setPaused(false); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), ++resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when playing. - audio.setPaused(false); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when playing. - audio.pause(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - audio.setPlaying(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // setPaused(true) when stopped and paused. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when stopped and paused. - audio.setPaused(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when stopped. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(true) when stopped and paused. - audio.setPlaying(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // play() when paused. - audio.play(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), ++resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when playing. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when paused. - audio.stop(); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // setPaused(true) when stopped. - audio.setPaused(true); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when stopped and paused. - audio.stop(); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when stopped. - audio.pause(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - audio.setPlaying(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // pause() when stopped and paused. - audio.pause(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - audio.setPlaying(false); - QCOMPARE(audio.isPlaying(), false); - QCOMPARE(audio.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // play() when stopped and paused. - audio.play(); - QCOMPARE(audio.isPlaying(), true); - QCOMPARE(audio.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); -} - -void tst_QmlAudio::duration() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(durationChanged())); - - QCOMPARE(audio.duration(), 0); - - provider.playerControl()->setDuration(4040); - QCOMPARE(audio.duration(), 4040); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setDuration(-129); - QCOMPARE(audio.duration(), -129); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setDuration(0); - QCOMPARE(audio.duration(), 0); - QCOMPARE(spy.count(), 3); - - // Unnecessary duration changed signals aren't filtered. - provider.playerControl()->setDuration(0); - QCOMPARE(audio.duration(), 0); - QCOMPARE(spy.count(), 4); -} - -void tst_QmlAudio::position() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(positionChanged())); - - QCOMPARE(audio.position(), 0); - - // QmlAudio won't bound set positions to the duration. A media service may though. - QCOMPARE(audio.duration(), 0); - - audio.setPosition(450); - QCOMPARE(audio.position(), 450); - QCOMPARE(provider.playerControl()->position(), qint64(450)); - QCOMPARE(spy.count(), 1); - - audio.setPosition(-5403); - QCOMPARE(audio.position(), -5403); - QCOMPARE(provider.playerControl()->position(), qint64(-5403)); - QCOMPARE(spy.count(), 2); - - audio.setPosition(-5403); - QCOMPARE(audio.position(), -5403); - QCOMPARE(provider.playerControl()->position(), qint64(-5403)); - QCOMPARE(spy.count(), 3); - - // Check the signal change signal is emitted if the change originates from the media service. - provider.playerControl()->setPosition(0); - QCOMPARE(audio.position(), 0); - QCOMPARE(spy.count(), 4); - - connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop())); - - provider.playerControl()->updateState(QMediaPlayer::PlayingState); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() > 4 && spy.count() < 7); // 5 or 6 - - provider.playerControl()->updateState(QMediaPlayer::PausedState); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() < 7); -} - -void tst_QmlAudio::volume() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(volumeChanged())); - - QCOMPARE(audio.volume(), qreal(0.5)); - - audio.setVolume(0.7); - QCOMPARE(audio.volume(), qreal(0.7)); - QCOMPARE(provider.playerControl()->volume(), 70); - QCOMPARE(spy.count(), 1); - - audio.setVolume(0.7); - QCOMPARE(audio.volume(), qreal(0.7)); - QCOMPARE(provider.playerControl()->volume(), 70); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setVolume(30); - QCOMPARE(audio.volume(), qreal(0.3)); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlAudio::muted() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(mutedChanged())); - - QCOMPARE(audio.isMuted(), false); - - audio.setMuted(true); - QCOMPARE(audio.isMuted(), true); - QCOMPARE(provider.playerControl()->isMuted(), true); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setMuted(false); - QCOMPARE(audio.isMuted(), false); - QCOMPARE(spy.count(), 2); - - audio.setMuted(false); - QCOMPARE(audio.isMuted(), false); - QCOMPARE(provider.playerControl()->isMuted(), false); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlAudio::bufferProgress() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(bufferProgressChanged())); - - QCOMPARE(audio.bufferProgress(), qreal(0.0)); - - provider.playerControl()->setBufferStatus(20); - QCOMPARE(audio.bufferProgress(), qreal(0.2)); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setBufferStatus(20); - QCOMPARE(audio.bufferProgress(), qreal(0.2)); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setBufferStatus(40); - QCOMPARE(audio.bufferProgress(), qreal(0.4)); - QCOMPARE(spy.count(), 3); - - connect(&audio, SIGNAL(positionChanged()), &QTestEventLoop::instance(), SLOT(exitLoop())); - - provider.playerControl()->updateMediaStatus( - QMediaPlayer::BufferingMedia, QMediaPlayer::PlayingState); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() > 3 && spy.count() < 6); // 4 or 5 - - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); - QTestEventLoop::instance().enterLoop(1); - QVERIFY(spy.count() < 6); -} - -void tst_QmlAudio::seekable() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(seekableChanged())); - - QCOMPARE(audio.isSeekable(), false); - - provider.playerControl()->setSeekable(true); - QCOMPARE(audio.isSeekable(), true); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setSeekable(true); - QCOMPARE(audio.isSeekable(), true); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setSeekable(false); - QCOMPARE(audio.isSeekable(), false); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlAudio::playbackRate() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(playbackRateChanged())); - - QCOMPARE(audio.playbackRate(), qreal(1.0)); - - audio.setPlaybackRate(0.5); - QCOMPARE(audio.playbackRate(), qreal(0.5)); - QCOMPARE(provider.playerControl()->playbackRate(), qreal(0.5)); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setPlaybackRate(2.0); - QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0)); - QCOMPARE(spy.count(), 2); - - audio.setPlaybackRate(2.0); - QCOMPARE(audio.playbackRate(), qreal(2.0)); - QCOMPARE(provider.playerControl()->playbackRate(), qreal(2.0)); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlAudio::status() -{ - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy statusChangedSpy(&audio, SIGNAL(statusChanged())); - QSignalSpy loadedSpy(&audio, SIGNAL(loaded())); - QSignalSpy bufferingSpy(&audio, SIGNAL(buffering())); - QSignalSpy stalledSpy(&audio, SIGNAL(stalled())); - QSignalSpy bufferedSpy(&audio, SIGNAL(buffered())); - QSignalSpy endOfMediaSpy(&audio, SIGNAL(endOfMedia())); - - QCOMPARE(audio.status(), QmlAudio::NoMedia); - - // Set media, start loading. - provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadingMedia); - QCOMPARE(audio.status(), QmlAudio::Loading); - QCOMPARE(statusChangedSpy.count(), 1); - QCOMPARE(loadedSpy.count(), 0); - QCOMPARE(bufferingSpy.count(), 0); - QCOMPARE(stalledSpy.count(), 0); - QCOMPARE(bufferedSpy.count(), 0); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Finish loading. - provider.playerControl()->updateMediaStatus(QMediaPlayer::LoadedMedia); - QCOMPARE(audio.status(), QmlAudio::Loaded); - QCOMPARE(statusChangedSpy.count(), 2); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 0); - QCOMPARE(stalledSpy.count(), 0); - QCOMPARE(bufferedSpy.count(), 0); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Play, start buffering. - provider.playerControl()->updateMediaStatus( - QMediaPlayer::StalledMedia, QMediaPlayer::PlayingState); - QCOMPARE(audio.status(), QmlAudio::Stalled); - QCOMPARE(statusChangedSpy.count(), 3); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 0); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 0); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Enough data buffered to proceed. - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); - QCOMPARE(audio.status(), QmlAudio::Buffering); - QCOMPARE(statusChangedSpy.count(), 4); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 1); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 0); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Errant second buffering status changed. - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); - QCOMPARE(audio.status(), QmlAudio::Buffering); - QCOMPARE(statusChangedSpy.count(), 4); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 1); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 0); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Buffer full. - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); - QCOMPARE(audio.status(), QmlAudio::Buffered); - QCOMPARE(statusChangedSpy.count(), 5); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 1); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 1); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Buffer getting low. - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferingMedia); - QCOMPARE(audio.status(), QmlAudio::Buffering); - QCOMPARE(statusChangedSpy.count(), 6); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 2); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 1); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Buffer full. - provider.playerControl()->updateMediaStatus(QMediaPlayer::BufferedMedia); - QCOMPARE(audio.status(), QmlAudio::Buffered); - QCOMPARE(statusChangedSpy.count(), 7); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 2); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 2); - QCOMPARE(endOfMediaSpy.count(), 0); - - // Finished. - provider.playerControl()->updateMediaStatus( - QMediaPlayer::EndOfMedia, QMediaPlayer::StoppedState); - QCOMPARE(audio.status(), QmlAudio::EndOfMedia); - QCOMPARE(statusChangedSpy.count(), 8); - QCOMPARE(loadedSpy.count(), 1); - QCOMPARE(bufferingSpy.count(), 2); - QCOMPARE(stalledSpy.count(), 1); - QCOMPARE(bufferedSpy.count(), 2); - QCOMPARE(endOfMediaSpy.count(), 1); -} - -void tst_QmlAudio::metaData_data() -{ - QTest::addColumn<QByteArray>("propertyName"); - QTest::addColumn<QtMultimedia::MetaData>("propertyKey"); - QTest::addColumn<QVariant>("value1"); - QTest::addColumn<QVariant>("value2"); - - QTest::newRow("title") - << QByteArray("title") - << QtMultimedia::Title - << QVariant(QString::fromLatin1("This is a title")) - << QVariant(QString::fromLatin1("This is another title")); - - QTest::newRow("genre") - << QByteArray("genre") - << QtMultimedia::Genre - << QVariant(QString::fromLatin1("rock")) - << QVariant(QString::fromLatin1("pop")); - - QTest::newRow("trackNumber") - << QByteArray("trackNumber") - << QtMultimedia::TrackNumber - << QVariant(8) - << QVariant(12); -} - -void tst_QmlAudio::metaData() -{ - QFETCH(QByteArray, propertyName); - QFETCH(QtMultimedia::MetaData, propertyKey); - QFETCH(QVariant, value1); - QFETCH(QVariant, value2); - - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy spy(&audio, SIGNAL(__metaDataChanged())); - - const int index = audio.metaObject()->indexOfProperty(propertyName.constData()); - QVERIFY(index != -1); - - QMetaProperty property = audio.metaObject()->property(index); - QCOMPARE(property.read(&audio), QVariant()); - - property.write(&audio, value1); - QCOMPARE(property.read(&audio), value1); - QCOMPARE(provider.metaDataControl()->metaData(propertyKey), value1); - QCOMPARE(spy.count(), 1); - - provider.metaDataControl()->setMetaData(propertyKey, value2); - QCOMPARE(property.read(&audio), value2); - QCOMPARE(spy.count(), 2); -} - -void tst_QmlAudio::error() -{ - const QString errorString = QLatin1String("Failed to open device."); - - QtTestMediaServiceProvider provider; - QmlAudio audio; - - QSignalSpy errorSpy(&audio, SIGNAL(error(QmlAudio::Error,QString))); - QSignalSpy errorChangedSpy(&audio, SIGNAL(errorChanged())); - - QCOMPARE(audio.error(), QmlAudio::NoError); - QCOMPARE(audio.errorString(), QString()); - - provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString); - - QCOMPARE(audio.error(), QmlAudio::ResourceError); - QCOMPARE(audio.errorString(), errorString); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 1); - - // Changing the source resets the error properties. - audio.setSource(QUrl("http://example.com")); - QCOMPARE(audio.error(), QmlAudio::NoError); - QCOMPARE(audio.errorString(), QString()); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 2); - - // But isn't noisy. - audio.setSource(QUrl("file:///file/path")); - QCOMPARE(audio.error(), QmlAudio::NoError); - QCOMPARE(audio.errorString(), QString()); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 2); -} - - -QTEST_MAIN(tst_QmlAudio) - -#include "tst_qmlaudio.moc" diff --git a/tests/auto/qmlgraphicsvideo/qmlgraphicsvideo.pro b/tests/auto/qmlgraphicsvideo/qmlgraphicsvideo.pro deleted file mode 100644 index 0a83124..0000000 --- a/tests/auto/qmlgraphicsvideo/qmlgraphicsvideo.pro +++ /dev/null @@ -1,6 +0,0 @@ -load(qttest_p4) -SOURCES += tst_qmlgraphicsvideo.cpp - -QT += multimedia declarative -requires(contains(QT_CONFIG, multimedia)) -requires(contains(QT_CONFIG, declarative)) diff --git a/tests/auto/qmlgraphicsvideo/tst_qmlgraphicsvideo.cpp b/tests/auto/qmlgraphicsvideo/tst_qmlgraphicsvideo.cpp deleted file mode 100644 index 0da094d..0000000 --- a/tests/auto/qmlgraphicsvideo/tst_qmlgraphicsvideo.cpp +++ /dev/null @@ -1,911 +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 <QtTest/QtTest> - -#include <QtMultimedia/private/qmlgraphicsvideo_p.h> - -#include <QtGui/qapplication.h> -#include <QtMultimedia/qabstractvideosurface.h> -#include <QtMultimedia/qgraphicsvideoitem.h> -#include <QtMultimedia/qmediaplayercontrol.h> -#include <QtMultimedia/qmediaservice.h> -#include <QtMultimedia/qvideooutputcontrol.h> -#include <QtMultimedia/qvideorenderercontrol.h> -#include <QtMultimedia/qvideosurfaceformat.h> - - -class tst_QmlGraphicsVideo : public QObject -{ - Q_OBJECT -public slots: - void initTestCase(); - -private slots: - void nullPlayerControl(); - void nullService(); - - void playing(); - void paused(); - void error(); - - void hasAudio(); - void hasVideo(); - void fillMode(); - void geometry(); -}; - -Q_DECLARE_METATYPE(QtMultimedia::MetaData); -Q_DECLARE_METATYPE(QmlGraphicsVideo::Error); - -class QtTestMediaPlayerControl : public QMediaPlayerControl -{ - Q_OBJECT -public: - QtTestMediaPlayerControl(QObject *parent = 0) - : QMediaPlayerControl(parent) - , m_state(QMediaPlayer::StoppedState) - , m_mediaStatus(QMediaPlayer::NoMedia) - , m_duration(0) - , m_position(0) - , m_playbackRate(1.0) - , m_volume(50) - , m_bufferStatus(0) - , m_muted(false) - , m_audioAvailable(false) - , m_videoAvailable(false) - , m_seekable(false) - { - } - - QMediaPlayer::State state() const { return m_state; } - void updateState(QMediaPlayer::State state) { emit stateChanged(m_state = state); } - - QMediaPlayer::MediaStatus mediaStatus() const { return m_mediaStatus; } - void updateMediaStatus(QMediaPlayer::MediaStatus status) { - emit mediaStatusChanged(m_mediaStatus = status); } - void updateMediaStatus(QMediaPlayer::MediaStatus status, QMediaPlayer::State state) - { - m_mediaStatus = status; - m_state = state; - - emit mediaStatusChanged(m_mediaStatus); - emit stateChanged(m_state); - } - - qint64 duration() const { return m_duration; } - void setDuration(qint64 duration) { emit durationChanged(m_duration = duration); } - - qint64 position() const { return m_position; } - void setPosition(qint64 position) { emit positionChanged(m_position = position); } - - int volume() const { return m_volume; } - void setVolume(int volume) { emit volumeChanged(m_volume = volume); } - - bool isMuted() const { return m_muted; } - void setMuted(bool muted) { emit mutedChanged(m_muted = muted); } - - int bufferStatus() const { return m_bufferStatus; } - void setBufferStatus(int status) { emit bufferStatusChanged(m_bufferStatus = status); } - - bool isAudioAvailable() const { return m_audioAvailable; } - void setAudioAvailable(bool available) { - emit audioAvailableChanged(m_audioAvailable = available); } - bool isVideoAvailable() const { return m_videoAvailable; } - void setVideoAvailable(bool available) { - emit videoAvailableChanged(m_videoAvailable = available); } - - bool isSeekable() const { return m_seekable; } - void setSeekable(bool seekable) { emit seekableChanged(m_seekable = seekable); } - - QMediaTimeRange availablePlaybackRanges() const { return QMediaTimeRange(); } - - qreal playbackRate() const { return m_playbackRate; } - void setPlaybackRate(qreal rate) { emit playbackRateChanged(m_playbackRate = rate); } - - QMediaContent media() const { return m_media; } - const QIODevice *mediaStream() const { return 0; } - void setMedia(const QMediaContent &media, QIODevice *) - { - m_media = media; - - m_mediaStatus = m_media.isNull() - ? QMediaPlayer::NoMedia - : QMediaPlayer::LoadingMedia; - - emit mediaChanged(m_media); - emit mediaStatusChanged(m_mediaStatus); - } - - void play() { emit stateChanged(m_state = QMediaPlayer::PlayingState); } - void pause() { emit stateChanged(m_state = QMediaPlayer::PausedState); } - void stop() { emit stateChanged(m_state = QMediaPlayer::StoppedState); } - - void emitError(QMediaPlayer::Error err, const QString &errorString) { - emit error(err, errorString); } - -private: - QMediaPlayer::State m_state; - QMediaPlayer::MediaStatus m_mediaStatus; - qint64 m_duration; - qint64 m_position; - qreal m_playbackRate; - int m_volume; - int m_bufferStatus; - bool m_muted; - bool m_audioAvailable; - bool m_videoAvailable; - bool m_seekable; - QMediaContent m_media; -}; - -class QtTestOutputControl : public QVideoOutputControl -{ -public: - QtTestOutputControl(QObject *parent) : QVideoOutputControl(parent), m_output(NoOutput) {} - - QList<Output> availableOutputs() const { return m_outputs; } - void setAvailableOutputs(const QList<Output> outputs) { m_outputs = outputs; } - - Output output() const { return m_output; } - virtual void setOutput(Output output) { m_output = output; } - -private: - Output m_output; - QList<Output> m_outputs; -}; - -class QtTestRendererControl : public QVideoRendererControl -{ -public: - QtTestRendererControl(QObject *parent ) : QVideoRendererControl(parent), m_surface(0) {} - - QAbstractVideoSurface *surface() const { return m_surface; } - void setSurface(QAbstractVideoSurface *surface) { m_surface = surface; } - -private: - QAbstractVideoSurface *m_surface; -}; - -class QtTestMediaService : public QMediaService -{ - Q_OBJECT -public: - QtTestMediaService( - QtTestMediaPlayerControl *playerControl, - QtTestOutputControl *outputControl, - QtTestRendererControl *rendererControl, - QObject *parent) - : QMediaService(parent) - , playerControl(playerControl) - , outputControl(outputControl) - , rendererControl(rendererControl) - { - } - - QMediaControl *control(const char *name) const - { - if (qstrcmp(name, QMediaPlayerControl_iid) == 0) - return playerControl; - else if (qstrcmp(name, QVideoOutputControl_iid) == 0) - return outputControl; - else if (qstrcmp(name, QVideoRendererControl_iid) == 0) - return rendererControl; - else - return 0; - } - - QtTestMediaPlayerControl *playerControl; - QtTestOutputControl *outputControl; - QtTestRendererControl *rendererControl; -}; - -class QtTestMediaServiceProvider : public QMediaServiceProvider -{ - Q_OBJECT -public: - QtTestMediaServiceProvider() - : service(new QtTestMediaService( - new QtTestMediaPlayerControl(this), - new QtTestOutputControl(this), - new QtTestRendererControl(this), - this)) - { - setDefaultServiceProvider(this); - } - - QtTestMediaServiceProvider(QtTestMediaService *service) - : service(service) - { - setDefaultServiceProvider(this); - } - - QtTestMediaServiceProvider( - QtTestMediaPlayerControl *playerControl, - QtTestOutputControl *outputControl, - QtTestRendererControl *rendererControl) - : service(new QtTestMediaService(playerControl, outputControl, rendererControl, this)) - { - setDefaultServiceProvider(this); - } - - ~QtTestMediaServiceProvider() - { - setDefaultServiceProvider(0); - } - - QMediaService *requestService( - const QByteArray &type, - const QMediaServiceProviderHint & = QMediaServiceProviderHint()) - { - requestedService = type; - - return service; - } - - void releaseService(QMediaService *) {} - - inline QtTestMediaPlayerControl *playerControl() { return service->playerControl; } - inline QtTestRendererControl *rendererControl() { return service->rendererControl; } - - QtTestMediaService *service; - QByteArray requestedService; -}; - - -void tst_QmlGraphicsVideo::initTestCase() -{ - qRegisterMetaType<QmlGraphicsVideo::Error>(); -} - -void tst_QmlGraphicsVideo::nullPlayerControl() -{ - QtTestMediaServiceProvider provider(0, 0, 0); - - QmlGraphicsVideo video; - - QCOMPARE(video.source(), QUrl()); - video.setSource(QUrl("http://example.com")); - QCOMPARE(video.source(), QUrl()); - - QCOMPARE(video.isPlaying(), false); - video.setPlaying(true); - QCOMPARE(video.isPlaying(), false); - video.play(); - QCOMPARE(video.isPlaying(), false); - - QCOMPARE(video.isPaused(), false); - video.pause(); - QCOMPARE(video.isPaused(), false); - video.setPaused(true); - QCOMPARE(video.isPaused(), true); - - QCOMPARE(video.duration(), 0); - - QCOMPARE(video.position(), 0); - video.setPosition(10000); - QCOMPARE(video.position(), 0); - - QCOMPARE(video.volume(), qreal(0)); - video.setVolume(50); - QCOMPARE(video.volume(), qreal(0)); - - QCOMPARE(video.isMuted(), false); - video.setMuted(true); - QCOMPARE(video.isMuted(), false); - - QCOMPARE(video.bufferProgress(), qreal(0)); - - QCOMPARE(video.isSeekable(), false); - - QCOMPARE(video.playbackRate(), qreal(1.0)); - - QCOMPARE(video.hasAudio(), false); - QCOMPARE(video.hasVideo(), false); - - QCOMPARE(video.status(), QmlGraphicsVideo::NoMedia); - - QCOMPARE(video.error(), QmlGraphicsVideo::ServiceMissing); -} - -void tst_QmlGraphicsVideo::nullService() -{ - QtTestMediaServiceProvider provider(0); - - QmlGraphicsVideo video; - - QCOMPARE(video.source(), QUrl()); - video.setSource(QUrl("http://example.com")); - QCOMPARE(video.source(), QUrl()); - - QCOMPARE(video.isPlaying(), false); - video.setPlaying(true); - QCOMPARE(video.isPlaying(), false); - video.play(); - QCOMPARE(video.isPlaying(), false); - - QCOMPARE(video.isPaused(), false); - video.pause(); - QCOMPARE(video.isPaused(), false); - video.setPaused(true); - QCOMPARE(video.isPaused(), true); - - QCOMPARE(video.duration(), 0); - - QCOMPARE(video.position(), 0); - video.setPosition(10000); - QCOMPARE(video.position(), 0); - - QCOMPARE(video.volume(), qreal(0)); - video.setVolume(50); - QCOMPARE(video.volume(), qreal(0)); - - QCOMPARE(video.isMuted(), false); - video.setMuted(true); - QCOMPARE(video.isMuted(), false); - - QCOMPARE(video.bufferProgress(), qreal(0)); - - QCOMPARE(video.isSeekable(), false); - - QCOMPARE(video.playbackRate(), qreal(1.0)); - - QCOMPARE(video.hasAudio(), false); - QCOMPARE(video.hasVideo(), false); - - QCOMPARE(video.status(), QmlGraphicsVideo::NoMedia); - - QCOMPARE(video.error(), QmlGraphicsVideo::ServiceMissing); - - QCOMPARE(video.metaObject()->indexOfProperty("title"), -1); - QCOMPARE(video.metaObject()->indexOfProperty("genre"), -1); - QCOMPARE(video.metaObject()->indexOfProperty("description"), -1); -} - -void tst_QmlGraphicsVideo::playing() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); - QSignalSpy startedSpy(&video, SIGNAL(started())); - QSignalSpy stoppedSpy(&video, SIGNAL(stopped())); - - int playingChanged = 0; - int started = 0; - int stopped = 0; - - QCOMPARE(video.isPlaying(), false); - - // setPlaying(true) when stopped. - video.setPlaying(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when playing. - video.setPlaying(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // play() when stopped. - video.play(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when playing. - video.stop(); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // stop() when stopped. - video.stop(); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when stopped. - video.setPlaying(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - video.setPlaying(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(true) when playing. - video.setPlaying(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); - - // play() when playing. - video.play(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(stoppedSpy.count(), stopped); -} - -void tst_QmlGraphicsVideo::paused() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QSignalSpy playingChangedSpy(&video, SIGNAL(playingChanged())); - QSignalSpy pausedChangedSpy(&video, SIGNAL(pausedChanged())); - QSignalSpy startedSpy(&video, SIGNAL(started())); - QSignalSpy pausedSpy(&video, SIGNAL(paused())); - QSignalSpy resumedSpy(&video, SIGNAL(resumed())); - QSignalSpy stoppedSpy(&video, SIGNAL(stopped())); - - int playingChanged = 0; - int pausedChanged = 0; - int started = 0; - int paused = 0; - int resumed = 0; - int stopped = 0; - - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), false); - - // setPlaying(true) when stopped. - video.setPlaying(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when playing. - video.setPaused(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when paused. - video.setPaused(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when paused. - video.pause(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when paused. - video.setPaused(false); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), ++resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when playing. - video.setPaused(false); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when playing. - video.pause(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - video.setPlaying(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // setPaused(true) when stopped and paused. - video.setPaused(true); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(false) when stopped and paused. - video.setPaused(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when stopped. - video.setPaused(true); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(true) when stopped and paused. - video.setPlaying(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // play() when paused. - video.play(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), ++resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPaused(true) when playing. - video.setPaused(true); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when paused. - video.stop(); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // setPaused(true) when stopped. - video.setPaused(true); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // stop() when stopped and paused. - video.stop(); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // pause() when stopped. - video.pause(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - video.setPlaying(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // pause() when stopped and paused. - video.pause(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PausedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), ++paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); - - // setPlaying(false) when paused. - video.setPlaying(false); - QCOMPARE(video.isPlaying(), false); - QCOMPARE(video.isPaused(), true); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::StoppedState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), pausedChanged); - QCOMPARE(startedSpy.count(), started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), ++stopped); - - // play() when stopped and paused. - video.play(); - QCOMPARE(video.isPlaying(), true); - QCOMPARE(video.isPaused(), false); - QCOMPARE(provider.playerControl()->state(), QMediaPlayer::PlayingState); - QCOMPARE(playingChangedSpy.count(), ++playingChanged); - QCOMPARE(pausedChangedSpy.count(), ++pausedChanged); - QCOMPARE(startedSpy.count(), ++started); - QCOMPARE(pausedSpy.count(), paused); - QCOMPARE(resumedSpy.count(), resumed); - QCOMPARE(stoppedSpy.count(), stopped); -} - -void tst_QmlGraphicsVideo::error() -{ - const QString errorString = QLatin1String("Failed to open device."); - - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QSignalSpy errorSpy(&video, SIGNAL(error(QmlGraphicsVideo::Error,QString))); - QSignalSpy errorChangedSpy(&video, SIGNAL(errorChanged())); - - QCOMPARE(video.error(), QmlGraphicsVideo::NoError); - QCOMPARE(video.errorString(), QString()); - - provider.playerControl()->emitError(QMediaPlayer::ResourceError, errorString); - - QCOMPARE(video.error(), QmlGraphicsVideo::ResourceError); - QCOMPARE(video.errorString(), errorString); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 1); - - // Changing the source resets the error properties. - video.setSource(QUrl("http://example.com")); - QCOMPARE(video.error(), QmlGraphicsVideo::NoError); - QCOMPARE(video.errorString(), QString()); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 2); - - // But isn't noisy. - video.setSource(QUrl("file:///file/path")); - QCOMPARE(video.error(), QmlGraphicsVideo::NoError); - QCOMPARE(video.errorString(), QString()); - QCOMPARE(errorSpy.count(), 1); - QCOMPARE(errorChangedSpy.count(), 2); -} - - -void tst_QmlGraphicsVideo::hasAudio() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QSignalSpy spy(&video, SIGNAL(hasAudioChanged())); - - QCOMPARE(video.hasAudio(), false); - - provider.playerControl()->setAudioAvailable(true); - QCOMPARE(video.hasAudio(), true); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setAudioAvailable(true); - QCOMPARE(video.hasAudio(), true); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setAudioAvailable(false); - QCOMPARE(video.hasAudio(), false); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlGraphicsVideo::hasVideo() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QSignalSpy spy(&video, SIGNAL(hasVideoChanged())); - - QCOMPARE(video.hasVideo(), false); - - provider.playerControl()->setVideoAvailable(true); - QCOMPARE(video.hasVideo(), true); - QCOMPARE(spy.count(), 1); - - provider.playerControl()->setVideoAvailable(true); - QCOMPARE(video.hasVideo(), true); - QCOMPARE(spy.count(), 2); - - provider.playerControl()->setVideoAvailable(false); - QCOMPARE(video.hasVideo(), false); - QCOMPARE(spy.count(), 3); -} - -void tst_QmlGraphicsVideo::fillMode() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QList<QGraphicsItem *> children = video.childItems(); - QCOMPARE(children.count(), 1); - QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first()); - QVERIFY(videoItem != 0); - - QCOMPARE(video.fillMode(), QmlGraphicsVideo::PreserveAspectFit); - - video.setFillMode(QmlGraphicsVideo::PreserveAspectCrop); - QCOMPARE(video.fillMode(), QmlGraphicsVideo::PreserveAspectCrop); - QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatioByExpanding); - - video.setFillMode(QmlGraphicsVideo::Stretch); - QCOMPARE(video.fillMode(), QmlGraphicsVideo::Stretch); - QCOMPARE(videoItem->aspectRatioMode(), Qt::IgnoreAspectRatio); - - video.setFillMode(QmlGraphicsVideo::PreserveAspectFit); - QCOMPARE(video.fillMode(), QmlGraphicsVideo::PreserveAspectFit); - QCOMPARE(videoItem->aspectRatioMode(), Qt::KeepAspectRatio); -} - -void tst_QmlGraphicsVideo::geometry() -{ - QtTestMediaServiceProvider provider; - QmlGraphicsVideo video; - - QAbstractVideoSurface *surface = provider.rendererControl()->surface(); - QVERIFY(surface != 0); - - QList<QGraphicsItem *> children = video.childItems(); - QCOMPARE(children.count(), 1); - QGraphicsVideoItem *videoItem = qgraphicsitem_cast<QGraphicsVideoItem *>(children.first()); - QVERIFY(videoItem != 0); - - QVideoSurfaceFormat format(QSize(640, 480), QVideoFrame::Format_RGB32); - - QVERIFY(surface->start(format)); - - QCOMPARE(video.implicitWidth(), qreal(640)); - QCOMPARE(video.implicitHeight(), qreal(480)); - - video.setWidth(560); - video.setHeight(328); - - QCOMPARE(videoItem->size().width(), qreal(560)); - QCOMPARE(videoItem->size().height(), qreal(328)); -} - -QTEST_MAIN(tst_QmlGraphicsVideo) - -#include "tst_qmlgraphicsvideo.moc" diff --git a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp index 66cfeb7..849b8b2 100644 --- a/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp +++ b/tests/auto/qpropertyanimation/tst_qpropertyanimation.cpp @@ -40,6 +40,7 @@ ****************************************************************************/ #include <QtTest/QtTest> +#include "../../shared/util.h" #include <QtCore/qpropertyanimation.h> #include <QtCore/qvariantanimation.h> @@ -288,7 +289,7 @@ void tst_QPropertyAnimation::statesAndSignals() anim->start(); QTest::qWait(1000); - QCOMPARE(anim->state(), QAnimationGroup::Stopped); + QTRY_COMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(runningSpy.count(), 2); //started and stopped again runningSpy.clear(); QCOMPARE(finishedSpy.count(), 1); @@ -340,7 +341,7 @@ void tst_QPropertyAnimation::deletion1() QCOMPARE(anim->state(), QAnimationGroup::Running); QTest::qWait(150); QVERIFY(anim); //The animation should not have been deleted - QCOMPARE(anim->state(), QAnimationGroup::Stopped); + QTRY_COMPARE(anim->state(), QAnimationGroup::Stopped); QCOMPARE(runningSpy.count(), 2); QCOMPARE(finishedSpy.count(), 1); @@ -351,9 +352,9 @@ void tst_QPropertyAnimation::deletion1() QVERIFY(anim); QCOMPARE(anim->state(), QAnimationGroup::Running); QTest::qWait(150); - QVERIFY(!anim); //The animation must have been deleted - QCOMPARE(runningSpy.count(), 4); + QTRY_COMPARE(runningSpy.count(), 4); QCOMPARE(finishedSpy.count(), 2); + QVERIFY(!anim); //The animation must have been deleted delete object; } @@ -459,7 +460,7 @@ void tst_QPropertyAnimation::noStartValue() QTest::qWait(300); - QCOMPARE(o.values.first(), 42); + QTRY_COMPARE(o.values.first(), 42); QCOMPARE(o.values.last(), 420); } @@ -497,7 +498,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() QSignalSpy runningSpy(anim, SIGNAL(stateChanged(QAbstractAnimation::State, QAbstractAnimation::State))); anim->start(QVariantAnimation::DeleteWhenStopped); QTest::qWait(anim->duration() + 100); - QCOMPARE(runningSpy.count(), 2); //started and then stopped + QTRY_COMPARE(runningSpy.count(), 2); //started and then stopped QVERIFY(!anim); } @@ -518,7 +519,7 @@ void tst_QPropertyAnimation::startWhenAnotherIsRunning() QVERIFY(!anim); //anim should have been deleted QVERIFY(anim2); QTest::qWait(anim2->duration()); - QVERIFY(!anim2); //anim2 is finished: it should have been deleted by now + QTRY_VERIFY(!anim2); //anim2 is finished: it should have been deleted by now QVERIFY(!anim); } @@ -591,7 +592,7 @@ void tst_QPropertyAnimation::startWithoutStartValue() QVERIFY(current < 100); QTest::qWait(200); - QCOMPARE(anim.state(), QVariantAnimation::Stopped); + QTRY_COMPARE(anim.state(), QVariantAnimation::Stopped); current = anim.currentValue().toInt(); QCOMPARE(current, 100); QCOMPARE(o.property("ole").toInt(), current); @@ -631,7 +632,7 @@ void tst_QPropertyAnimation::startBackwardWithoutEndValue() QVERIFY(current < 100); QTest::qWait(200); - QCOMPARE(anim.state(), QVariantAnimation::Stopped); + QTRY_COMPARE(anim.state(), QVariantAnimation::Stopped); current = anim.currentValue().toInt(); QCOMPARE(current, 100); QCOMPARE(o.property("ole").toInt(), current); @@ -661,7 +662,7 @@ void tst_QPropertyAnimation::playForwardBackward() anim.setEndValue(100); anim.start(); QTest::qWait(anim.duration() + 100); - QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); QCOMPARE(anim.currentTime(), anim.duration()); //the animation is at the end @@ -669,7 +670,7 @@ void tst_QPropertyAnimation::playForwardBackward() anim.start(); QCOMPARE(anim.state(), QAbstractAnimation::Running); QTest::qWait(anim.duration() + 100); - QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); QCOMPARE(anim.currentTime(), 0); //the direction is backward @@ -678,7 +679,7 @@ void tst_QPropertyAnimation::playForwardBackward() QCOMPARE(anim.state(), QAbstractAnimation::Running); QCOMPARE(anim.currentTime(), anim.duration()); QTest::qWait(anim.duration() + 100); - QCOMPARE(anim.state(), QAbstractAnimation::Stopped); + QTRY_COMPARE(anim.state(), QAbstractAnimation::Stopped); QCOMPARE(anim.currentTime(), 0); } @@ -1146,7 +1147,7 @@ void tst_QPropertyAnimation::twoAnimations() o2.anim.start(); QTest::qWait(o1.anim.duration() + 100); - QCOMPARE(o1.anim.state(), QAbstractAnimation::Stopped); + QTRY_COMPARE(o1.anim.state(), QAbstractAnimation::Stopped); QCOMPARE(o2.anim.state(), QAbstractAnimation::Stopped); QCOMPARE(o1.ole(), 1000); @@ -1197,7 +1198,7 @@ void tst_QPropertyAnimation::deletedInUpdateCurrentTime() QCOMPARE(composedAnimation.state(), QAbstractAnimation::Running); QTest::qWait(composedAnimation.duration() + 100); - QCOMPARE(composedAnimation.state(), QAbstractAnimation::Stopped); + QTRY_COMPARE(composedAnimation.state(), QAbstractAnimation::Stopped); QCOMPARE(o.value(), 1000); } diff --git a/tests/auto/qscriptstring/tst_qscriptstring.cpp b/tests/auto/qscriptstring/tst_qscriptstring.cpp index 808b643..ea4a92b 100644 --- a/tests/auto/qscriptstring/tst_qscriptstring.cpp +++ b/tests/auto/qscriptstring/tst_qscriptstring.cpp @@ -177,6 +177,12 @@ void tst_QScriptString::toArrayIndex_data() QTest::newRow("101a") << QString::fromLatin1("101a") << false << quint32(0xffffffff); QTest::newRow("4294967294") << QString::fromLatin1("4294967294") << true << quint32(0xfffffffe); QTest::newRow("4294967295") << QString::fromLatin1("4294967295") << false << quint32(0xffffffff); + QTest::newRow("0.0") << QString::fromLatin1("0.0") << false << quint32(0xffffffff); + QTest::newRow("1.0") << QString::fromLatin1("1.0") << false << quint32(0xffffffff); + QTest::newRow("1.5") << QString::fromLatin1("1.5") << false << quint32(0xffffffff); + QTest::newRow("1.") << QString::fromLatin1("1.") << false << quint32(0xffffffff); + QTest::newRow(".1") << QString::fromLatin1(".1") << false << quint32(0xffffffff); + QTest::newRow("1e0") << QString::fromLatin1("1e0") << false << quint32(0xffffffff); } void tst_QScriptString::toArrayIndex() diff --git a/tests/auto/qscriptvalue/qscriptvalue.pro b/tests/auto/qscriptvalue/qscriptvalue.pro index 1588cc5..191cd4a 100644 --- a/tests/auto/qscriptvalue/qscriptvalue.pro +++ b/tests/auto/qscriptvalue/qscriptvalue.pro @@ -5,3 +5,10 @@ HEADERS += tst_qscriptvalue.h # Generated by testgen SOURCES += tst_qscriptvalue_generated.cpp + + +win32-msvc* { + # With -O2, MSVC takes up to 24 minutes to compile this test! + QMAKE_CXXFLAGS_RELEASE -= -O1 -O2 + QMAKE_CXXFLAGS_RELEASE += -Od +} diff --git a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp index 68daf1a..e154528 100644 --- a/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp +++ b/tests/auto/qsequentialanimationgroup/tst_qsequentialanimationgroup.cpp @@ -934,8 +934,8 @@ void tst_QSequentialAnimationGroup::startDelay() QTest::qWait(500); + QTRY_COMPARE(group.state(), QAnimationGroup::Stopped); QVERIFY(group.currentLoopTime() == 375); - QCOMPARE(group.state(), QAnimationGroup::Stopped); } void tst_QSequentialAnimationGroup::clearGroup() @@ -1029,7 +1029,7 @@ void tst_QSequentialAnimationGroup::groupWithZeroDurationAnimations() QTest::qWait(500); - QCOMPARE(o.property("myProperty").toInt(), 44); + QTRY_COMPARE(o.property("myProperty").toInt(), 44); QCOMPARE(o2.property("myProperty").toInt(), 42); QCOMPARE(o2.property("myOtherProperty").toInt(), 31); QCOMPARE(a1->state(), QAnimationGroup::Stopped); @@ -1171,7 +1171,7 @@ void tst_QSequentialAnimationGroup::deleteChildrenWithRunningGroup() QCOMPARE(anim1->state(), QAnimationGroup::Running); QTest::qWait(100); - QVERIFY(group.currentLoopTime() > 0); + QTRY_VERIFY(group.currentLoopTime() > 0); delete anim1; QCOMPARE(group.animationCount(), 0); @@ -1430,7 +1430,7 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() QCOMPARE(notTimeDriven.currentLoopTime(), 0); QTest::qWait(300); //wait for the end of notTimeDriven - QCOMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); + QTRY_COMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); const int actualDuration = notTimeDriven.currentLoopTime(); QCOMPARE(group.state(), QAnimationGroup::Stopped); QCOMPARE(group.currentLoopTime(), actualDuration); @@ -1459,14 +1459,14 @@ void tst_QSequentialAnimationGroup::finishWithUncontrolledAnimation() QCOMPARE(animStateChangedSpy.count(), 0); QTest::qWait(300); //wait for the end of notTimeDriven - QCOMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); + QTRY_COMPARE(notTimeDriven.state(), QAnimationGroup::Stopped); QCOMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim.state(), QAnimationGroup::Running); QCOMPARE(group.currentAnimation(), static_cast<QAbstractAnimation*>(&anim)); QCOMPARE(animStateChangedSpy.count(), 1); QTest::qWait(300); //wait for the end of anim - QCOMPARE(anim.state(), QAnimationGroup::Stopped); + QTRY_COMPARE(anim.state(), QAnimationGroup::Stopped); QCOMPARE(anim.currentLoopTime(), anim.duration()); //we should simply be at the end @@ -1621,7 +1621,7 @@ void tst_QSequentialAnimationGroup::clear() group.start(); QTest::qWait(anim1->duration() + 100); - QCOMPARE(group.animationCount(), 0); + QTRY_COMPARE(group.animationCount(), 0); QCOMPARE(group.state(), QAbstractAnimation::Stopped); QCOMPARE(group.currentLoopTime(), 0); @@ -1629,8 +1629,8 @@ void tst_QSequentialAnimationGroup::clear() group.connect(anim1, SIGNAL(finished()), SLOT(refill())); group.start(); QTest::qWait(anim1->duration() + 100); + QTRY_COMPARE(group.state(), QAbstractAnimation::Running); QVERIFY(anim1 == 0); //anim1 should have been deleted - QCOMPARE(group.state(), QAbstractAnimation::Running); } void tst_QSequentialAnimationGroup::pauseResume() @@ -1645,7 +1645,7 @@ void tst_QSequentialAnimationGroup::pauseResume() QCOMPARE(group.duration(), 250); group.start(); QTest::qWait(100); - QCOMPARE(group.state(), QAnimationGroup::Running); + QTRY_COMPARE(group.state(), QAnimationGroup::Running); QCOMPARE(anim->state(), QAnimationGroup::Running); QCOMPARE(spy.count(), 1); spy.clear(); diff --git a/tests/auto/qurl/tst_qurl.cpp b/tests/auto/qurl/tst_qurl.cpp index 72ce393..83109b5 100644 --- a/tests/auto/qurl/tst_qurl.cpp +++ b/tests/auto/qurl/tst_qurl.cpp @@ -2513,13 +2513,9 @@ void tst_QUrl::schemeValidator() void tst_QUrl::invalidSchemeValidator() { - // enable that test when QUrl is fixed - return; - // test that if scheme does not start with an ALPHA, QUrl::isValid() returns false { QUrl url("1http://qt.nokia.com", QUrl::StrictMode); - qDebug() << url; QCOMPARE(url.isValid(), false); } { diff --git a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp index b325250..1238804 100644 --- a/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp +++ b/tests/benchmarks/corelib/io/qdir/10000/bench_qdir_10000.cpp @@ -156,6 +156,7 @@ private slots: } void sizeSpeedWithoutFilterLowLevel() { + QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); #ifdef Q_OS_WIN const wchar_t *dirpath = (wchar_t*)testdir.absolutePath().utf16(); wchar_t appendedPath[MAX_PATH]; @@ -173,7 +174,6 @@ private slots: } FindClose(hSearch); #else - QDir testdir(QDir::tempPath() + QLatin1String("/test_speed")); DIR *dir = opendir(qPrintable(testdir.absolutePath())); QVERIFY(dir); diff --git a/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt b/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt new file mode 100644 index 0000000..b915320 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/tree/4.6.0-list.txt @@ -0,0 +1,11963 @@ +0 src/ +0 3rdparty/ +0 ce-compat/ +0 ce_time.c + ce_time.h +2 clucene/ +0 APACHE.license + AUTHORS + ChangeLog + COPYING + LGPL.license + README + src/ +0 CLucene/ +0 analysis/ +0 AnalysisHeader.cpp + AnalysisHeader.h + Analyzers.cpp + Analyzers.h + standard/ +0 StandardAnalyzer.cpp + StandardAnalyzer.h + StandardFilter.cpp + StandardFilter.h + StandardTokenizerConstants.h + StandardTokenizer.cpp + StandardTokenizer.h +3 CLBackwards.h + CLConfig.h + CLMonolithic.cpp + config/ +0 CompilerAcc.h + CompilerBcb.h + CompilerGcc.h + compiler.h + CompilerMsvc.h + define_std.h + gunichartables.cpp + gunichartables.h + PlatformMac.h + PlatformUnix.h + PlatformWin32.h + repl_lltot.cpp + repl_tchar.h + repl_tcscasecmp.cpp + repl_tcslwr.cpp + repl_tcstod.cpp + repl_tcstoll.cpp + repl_tprintf.cpp + repl_wchar.h + threadCSection.h + threadPthread.h + threads.cpp + utf8.cpp +2 debug/ +0 condition.cpp + condition.h + error.cpp + error.h + lucenebase.h + mem.h + memtracking.cpp +2 document/ +0 DateField.cpp + DateField.h + Document.cpp + Document.h + Field.cpp + Field.h +3 CLucene.h + CLucene/index/ +0 CompoundFile.cpp + CompoundFile.h + DocumentWriter.cpp + DocumentWriter.h + FieldInfo.h + FieldInfos.cpp + FieldInfos.h + FieldsReader.cpp + FieldsReader.h + FieldsWriter.cpp + FieldsWriter.h + IndexModifier.cpp + IndexModifier.h + IndexReader.cpp + IndexReader.h + IndexWriter.cpp + IndexWriter.h + MultiReader.cpp + MultiReader.h + SegmentHeader.h + SegmentInfos.cpp + SegmentInfos.h + SegmentMergeInfo.cpp + SegmentMergeInfo.h + SegmentMergeQueue.cpp + SegmentMergeQueue.h + SegmentMerger.cpp + SegmentMerger.h + SegmentReader.cpp + SegmentTermDocs.cpp + SegmentTermEnum.cpp + SegmentTermEnum.h + SegmentTermPositions.cpp + SegmentTermVector.cpp + Term.cpp + Term.h + TermInfo.cpp + TermInfo.h + TermInfosReader.cpp + TermInfosReader.h + TermInfosWriter.cpp + TermInfosWriter.h + Terms.h + TermVector.h + TermVectorReader.cpp + TermVectorWriter.cpp +2 CLucene/LuceneThreads.h + CLucene/queryParser/ +0 Lexer.cpp + Lexer.h + MultiFieldQueryParser.cpp + MultiFieldQueryParser.h + QueryParserBase.cpp + QueryParserBase.h + QueryParser.cpp + QueryParser.h + QueryToken.cpp + QueryToken.h + TokenList.cpp + TokenList.h +2 CLucene/search/ +0 BooleanClause.h + BooleanQuery.cpp + BooleanQuery.h + BooleanScorer.cpp + BooleanScorer.h + CachingWrapperFilter.cpp + CachingWrapperFilter.h + ChainedFilter.cpp + ChainedFilter.h + Compare.h + ConjunctionScorer.cpp + ConjunctionScorer.h + DateFilter.cpp + DateFilter.h + ExactPhraseScorer.cpp + ExactPhraseScorer.h + Explanation.cpp + Explanation.h + FieldCache.cpp + FieldCache.h + FieldCacheImpl.cpp + FieldCacheImpl.h + FieldDoc.h + FieldDocSortedHitQueue.cpp + FieldDocSortedHitQueue.h + FieldSortedHitQueue.cpp + FieldSortedHitQueue.h + FilteredTermEnum.cpp + FilteredTermEnum.h + Filter.h + FuzzyQuery.cpp + FuzzyQuery.h + HitQueue.cpp + HitQueue.h + Hits.cpp + IndexSearcher.cpp + IndexSearcher.h + MultiSearcher.cpp + MultiSearcher.h + MultiTermQuery.cpp + MultiTermQuery.h + PhrasePositions.cpp + PhrasePositions.h + PhraseQuery.cpp + PhraseQuery.h + PhraseQueue.h + PhraseScorer.cpp + PhraseScorer.h + PrefixQuery.cpp + PrefixQuery.h + QueryFilter.cpp + QueryFilter.h + RangeFilter.cpp + RangeFilter.h + RangeQuery.cpp + RangeQuery.h + Scorer.h + SearchHeader.cpp + SearchHeader.h + Similarity.cpp + Similarity.h + SloppyPhraseScorer.cpp + SloppyPhraseScorer.h + Sort.cpp + Sort.h + TermQuery.cpp + TermQuery.h + TermScorer.cpp + TermScorer.h + WildcardQuery.cpp + WildcardQuery.h + WildcardTermEnum.cpp + WildcardTermEnum.h +2 CLucene/StdHeader.cpp + CLucene/StdHeader.h + CLucene/store/ +0 Directory.h + FSDirectory.cpp + FSDirectory.h + IndexInput.cpp + IndexInput.h + IndexOutput.cpp + IndexOutput.h + InputStream.h + Lock.cpp + Lock.h + MMapInput.cpp + OutputStream.h + RAMDirectory.cpp + RAMDirectory.h + TransactionalRAMDirectory.cpp + TransactionalRAMDirectory.h +2 CLucene/util/ +0 Arrays.h + BitSet.cpp + BitSet.h + bufferedstream.h + dirent.cpp + dirent.h + Equators.cpp + Equators.h + FastCharStream.cpp + FastCharStream.h + fileinputstream.cpp + fileinputstream.h + inputstreambuffer.h + jstreamsconfig.h + Misc.cpp + Misc.h + PriorityQueue.h + Reader.cpp + Reader.h + streambase.h + StringBuffer.cpp + StringBuffer.h + StringIntern.cpp + StringIntern.h + stringreader.h + subinputstream.h + ThreadLocal.cpp + ThreadLocal.h + VoidList.h + VoidMap.h +4 des/ +0 des.cpp +2 easing/ +0 easing.cpp + legal.qdoc +2 fonts/ +0 5x7.bdf + 6x13.bdf + COPYING.Cursor + COPYING.Helvetica + COPYING.Utopia + COPYRIGHT.BH + COPYRIGHT.Charter + COPYRIGHT.Courier + COPYRIGHT.DejaVu + COPYRIGHT.IBM + COPYRIGHT.Unifont + COPYRIGHT.Vera + helvB08.bdf + helvB10.bdf + helvB12.bdf + helvB14.bdf + helvB18.bdf + helvB24.bdf + helvBO08.bdf + helvBO10.bdf + helvBO12.bdf + helvBO14.bdf + helvBO18.bdf + helvBO24.bdf + helvO08.bdf + helvO10.bdf + helvO12.bdf + helvO14.bdf + helvO18.bdf + helvO24.bdf + helvR08.bdf + helvR10.bdf + helvR12.bdf + helvR14.bdf + helvR18.bdf + helvR24.bdf + micro.bdf + README.DejaVu + unifont.bdf +2 freetype/ +0 autogen.sh + builds/ +0 amiga/ +0 include/ +0 freetype/ +0 config/ +0 ftconfig.h + ftmodule.h +4 makefile +0 .os4 +2 README + smakefile + src/ +0 base/ +0 ftdebug.c + ftsystem.c +4 ansi/ +0 ansi-def.mk + ansi.mk +2 atari/ +0 ATARI.H + FNames.SIC + FREETYPE.PRJ + README.TXT +2 beos/ +0 beos-def.mk + beos.mk + detect.mk +2 compiler/ +0 ansi-cc.mk + bcc-dev.mk + bcc.mk + emx.mk + gcc-dev.mk + gcc.mk + intelc.mk + unix-lcc.mk + visualage.mk + visualc.mk + watcom.mk + win-lcc.mk +2 detect.mk + dos/ +0 detect.mk + dos-def.mk + dos-emx.mk + dos-gcc.mk + dos-wat.mk +2 exports.mk + freetype.mk + link_dos.mk + link_std.mk + mac/ +0 ascii2mpw.py + FreeType.m68k_cfm.make.txt + FreeType.m68k_far.make.txt + FreeType.ppc_carbon.make.txt + FreeType.ppc_classic.make.txt + ftlib.prj.xml + ftmac.c + README +2 modules.mk + newline + os2/ +0 detect.mk + os2-def.mk + os2-dev.mk + os2-gcc.mk +2 symbian/ +0 bld.inf + freetype.mmp +2 toplevel.mk + unix/ +0 aclocal.m4 + config.guess + config.sub + configure +0 .ac + .raw +2 detect.mk + freetype2.in + freetype2.m4 + freetype-config.in + ft2unix.h + ftconfig.h + ftconfig.in + ft-munmap.m4 + ftsystem.c + install.mk + install-sh + ltmain.sh + mkinstalldirs + unix-cc.in + unixddef.mk + unix-def.in + unix-dev.mk + unix-lcc.mk + unix.mk +2 vms/ +0 ftconfig.h + ftsystem.c +2 win32/ +0 detect.mk + ftdebug.c + vc2005/ +0 freetype.sln + freetype.vcproj + index.html +2 vc2008/ +0 freetype.sln + freetype.vcproj + index.html +2 visualc/ +0 freetype.dsp + freetype.dsw + index.html +2 w32-bccd.mk + w32-bcc.mk + w32-dev.mk + w32-gcc.mk + w32-icc.mk + w32-intl.mk + w32-lcc.mk + w32-mingw32.mk + w32-vcc.mk + w32-wat.mk + win32-def.mk +2 wince/ +0 ftdebug.c + vc2005-ce/ +0 freetype.sln + freetype.vcproj + index.html +2 vc2008-ce/ +0 freetype.sln + freetype.vcproj + index.html +4 ChangeLog +0 .20 + .21 + .22 +2 configure + devel/ +0 ft2build.h + ftoption.h +2 docs/ +0 CHANGES + CUSTOMIZE + DEBUG + formats.txt + FTL.TXT + GPL.TXT + INSTALL +0 .ANY + .CROSS + .GNU + .MAC + .UNIX + .VMS +2 LICENSE.TXT + MAKEPP + PATENTS + PROBLEMS + raster.txt + reference/ +0 ft2-base_interface.html + ft2-basic_types.html + ft2-bdf_fonts.html + ft2-bitmap_handling.html + ft2-cache_subsystem.html + ft2-cid_fonts.html + ft2-computations.html + ft2-font_formats.html + ft2-gasp_table.html + ft2-glyph_management.html + ft2-glyph_stroker.html + ft2-glyph_variants.html + ft2-gx_validation.html + ft2-gzip.html + ft2-header_file_macros.html + ft2-incremental.html + ft2-index.html + ft2-lcd_filtering.html + ft2-list_processing.html + ft2-lzw.html + ft2-mac_specific.html + ft2-module_management.html + ft2-multiple_masters.html + ft2-ot_validation.html + ft2-outline_processing.html + ft2-pfr_fonts.html + ft2-quick_advance.html + ft2-raster.html + ft2-sfnt_names.html + ft2-sizes_management.html + ft2-system_interface.html + ft2-toc.html + ft2-truetype_engine.html + ft2-truetype_tables.html + ft2-type1_tables.html + ft2-user_allocation.html + ft2-version.html + ft2-winfnt_fonts.html + README +2 release + TODO + TRUETYPE + UPGRADE.UNIX + VERSION.DLL +2 include/ +0 freetype/ +0 config/ +0 ftconfig.h + ftheader.h + ftmodule.h + ftoption.h + ftstdlib.h +2 freetype.h + ftadvanc.h + ftbbox.h + ftbdf.h + ftbitmap.h + ftcache.h + ftchapters.h + ftcid.h + fterrdef.h + fterrors.h + ftgasp.h + ftglyph.h + ftgxval.h + ftgzip.h + ftimage.h + ftincrem.h + ftlcdfil.h + ftlist.h + ftlzw.h + ftmac.h + ftmm.h + ftmodapi.h + ftmoderr.h + ftotval.h + ftoutln.h + ftpfr.h + ftrender.h + ftsizes.h + ftsnames.h + ftstroke.h + ftsynth.h + ftsystem.h + fttrigon.h + fttypes.h + ftwinfnt.h + ftxf86.h + internal/ +0 autohint.h + ftcalc.h + ftdebug.h + ftdriver.h + ftgloadr.h + ftmemory.h + ftobjs.h + ftrfork.h + ftserv.h + ftstream.h + fttrace.h + ftvalid.h + internal.h + pcftypes.h + psaux.h + pshints.h + services/ +0 svbdf.h + svcid.h + svgldict.h + svgxval.h + svkern.h + svmm.h + svotval.h + svpfr.h + svpostnm.h + svpscmap.h + svpsinfo.h + svsfnt.h + svttcmap.h + svtteng.h + svttglyf.h + svwinfnt.h + svxf86nm.h +2 sfnt.h + t1types.h + tttypes.h +2 t1tables.h + ttnameid.h + tttables.h + tttags.h + ttunpat.h +2 ft2build.h +2 Jamfile + Jamrules + Makefile + modules.cfg + objs/ +0 README +2 README +0 .CVS +2 src/ +0 autofit/ +0 afangles.c + afangles.h + afcjk.c + afcjk.h + afdummy.c + afdummy.h + aferrors.h + afglobal.c + afglobal.h + afhints.c + afhints.h + afindic.c + afindic.h + aflatin2.c + aflatin2.h + aflatin.c + aflatin.h + afloader.c + afloader.h + afmodule.c + afmodule.h + aftypes.h + afwarp.c + afwarp.h + autofit.c + Jamfile + module.mk + rules.mk +2 base/ +0 ftadvanc.c + ftapi.c + ftbase.c + ftbase.h + ftbbox.c + ftbdf.c + ftbitmap.c + ftcalc.c + ftcid.c + ftdbgmem.c + ftdebug.c + ftfstype.c + ftgasp.c + ftgloadr.c + ftglyph.c + ftgxval.c + ftinit.c + ftlcdfil.c + ftmac.c + ftmm.c + ftnames.c + ftobjs.c + ftotval.c + ftoutln.c + ftpatent.c + ftpfr.c + ftrfork.c + ftstream.c + ftstroke.c + ftsynth.c + ftsystem.c + fttrigon.c + fttype1.c + ftutil.c + ftwinfnt.c + ftxf86.c + Jamfile + rules.mk +2 bdf/ +0 bdf.c + bdfdrivr.c + bdfdrivr.h + bdferror.h + bdf.h + bdflib.c + Jamfile + module.mk + README + rules.mk +2 cache/ +0 ftcache.c + ftcbasic.c + ftccache.c + ftccache.h + ftccback.h + ftccmap.c + ftcerror.h + ftcglyph.c + ftcglyph.h + ftcimage.c + ftcimage.h + ftcmanag.c + ftcmanag.h + ftcmru.c + ftcmru.h + ftcsbits.c + ftcsbits.h + Jamfile + rules.mk +2 cff/ +0 cff.c + cffcmap.c + cffcmap.h + cffdrivr.c + cffdrivr.h + cfferrs.h + cffgload.c + cffgload.h + cffload.c + cffload.h + cffobjs.c + cffobjs.h + cffparse.c + cffparse.h + cfftoken.h + cfftypes.h + Jamfile + module.mk + rules.mk +2 cid/ +0 ciderrs.h + cidgload.c + cidgload.h + cidload.c + cidload.h + cidobjs.c + cidobjs.h + cidparse.c + cidparse.h + cidriver.c + cidriver.h + cidtoken.h + Jamfile + module.mk + rules.mk + type1cid.c +2 gxvalid/ +0 gxvalid.c + gxvalid.h + gxvbsln.c + gxvcommn.c + gxvcommn.h + gxverror.h + gxvfeat.c + gxvfeat.h + gxvfgen.c + gxvjust.c + gxvkern.c + gxvlcar.c + gxvmod.c + gxvmod.h + gxvmort0.c + gxvmort1.c + gxvmort2.c + gxvmort4.c + gxvmort5.c + gxvmort.c + gxvmort.h + gxvmorx0.c + gxvmorx1.c + gxvmorx2.c + gxvmorx4.c + gxvmorx5.c + gxvmorx.c + gxvmorx.h + gxvopbd.c + gxvprop.c + gxvtrak.c + Jamfile + module.mk + README + rules.mk +2 gzip/ +0 adler32.c + ftgzip.c + infblock.c + infblock.h + infcodes.c + infcodes.h + inffixed.h + inflate.c + inftrees.c + inftrees.h + infutil.c + infutil.h + Jamfile + rules.mk + zconf.h + zlib.h + zutil.c + zutil.h +2 Jamfile + lzw/ +0 ftlzw.c + ftzopen.c + ftzopen.h + Jamfile + rules.mk +2 otvalid/ +0 Jamfile + module.mk + otvalid.c + otvalid.h + otvbase.c + otvcommn.c + otvcommn.h + otverror.h + otvgdef.c + otvgpos.c + otvgpos.h + otvgsub.c + otvjstf.c + otvmath.c + otvmod.c + otvmod.h + rules.mk +2 pcf/ +0 Jamfile + module.mk + pcf.c + pcfdrivr.c + pcfdrivr.h + pcferror.h + pcf.h + pcfread.c + pcfread.h + pcfutil.c + pcfutil.h + README + rules.mk +2 pfr/ +0 Jamfile + module.mk + pfr.c + pfrcmap.c + pfrcmap.h + pfrdrivr.c + pfrdrivr.h + pfrerror.h + pfrgload.c + pfrgload.h + pfrload.c + pfrload.h + pfrobjs.c + pfrobjs.h + pfrsbit.c + pfrsbit.h + pfrtypes.h + rules.mk +2 psaux/ +0 afmparse.c + afmparse.h + Jamfile + module.mk + psaux.c + psauxerr.h + psauxmod.c + psauxmod.h + psconv.c + psconv.h + psobjs.c + psobjs.h + rules.mk + t1cmap.c + t1cmap.h + t1decode.c + t1decode.h +2 pshinter/ +0 Jamfile + module.mk + pshalgo.c + pshalgo.h + pshglob.c + pshglob.h + pshinter.c + pshmod.c + pshmod.h + pshnterr.h + pshrec.c + pshrec.h + rules.mk +2 psnames/ +0 Jamfile + module.mk + psmodule.c + psmodule.h + psnamerr.h + psnames.c + pstables.h + rules.mk +2 raster/ +0 ftmisc.h + ftraster.c + ftraster.h + ftrend1.c + ftrend1.h + Jamfile + module.mk + raster.c + rasterrs.h + rules.mk +2 sfnt/ +0 Jamfile + module.mk + rules.mk + sfdriver.c + sfdriver.h + sferrors.h + sfnt.c + sfobjs.c + sfobjs.h + ttbdf.c + ttbdf.h + ttcmap.c + ttcmap.h + ttkern.c + ttkern.h + ttload.c + ttload.h + ttmtx.c + ttmtx.h + ttpost.c + ttpost.h + ttsbit0.c + ttsbit.c + ttsbit.h +2 smooth/ +0 ftgrays.c + ftgrays.h + ftsmerrs.h + ftsmooth.c + ftsmooth.h + Jamfile + module.mk + rules.mk + smooth.c +2 tools/ +0 apinames.c + cordic.py + docmaker/ +0 content.py + docbeauty.py + docmaker.py + formatter.py + sources.py + tohtml.py + utils.py +2 ftrandom/ +0 ftrandom.c + Makefile + README +2 glnames.py + Jamfile + test_afm.c + test_bbox.c + test_trig.c +2 truetype/ +0 Jamfile + module.mk + rules.mk + truetype.c + ttdriver.c + ttdriver.h + tterrors.h + ttgload.c + ttgload.h + ttgxvar.c + ttgxvar.h + ttinterp.c + ttinterp.h + ttobjs.c + ttobjs.h + ttpload.c + ttpload.h +2 type1/ +0 Jamfile + module.mk + rules.mk + t1afm.c + t1afm.h + t1driver.c + t1driver.h + t1errors.h + t1gload.c + t1gload.h + t1load.c + t1load.h + t1objs.c + t1objs.h + t1parse.c + t1parse.h + t1tokens.h + type1.c +2 type42/ +0 Jamfile + module.mk + rules.mk + t42drivr.c + t42drivr.h + t42error.h + t42objs.c + t42objs.h + t42parse.c + t42parse.h + t42types.h + type42.c +2 winfonts/ +0 fnterrs.h + Jamfile + module.mk + rules.mk + winfnt.c + winfnt.h +3 version.sed + vms_make.com +2 .gitattributes + harfbuzz/ +0 AUTHORS + autogen.sh + ChangeLog + configure.ac + COPYING + .gitignore + Makefile.am + NEWS + README + src/ +0 .gitignore + harfbuzz-arabic.c + harfbuzz-buffer.c + harfbuzz-buffer.h + harfbuzz-buffer-private.h + harfbuzz.c + harfbuzz-dump.c + harfbuzz-dump.h + harfbuzz-dump-main.c + harfbuzz-external.h + harfbuzz-gdef.c + harfbuzz-gdef.h + harfbuzz-gdef-private.h + harfbuzz-global.h + harfbuzz-gpos.c + harfbuzz-gpos.h + harfbuzz-gpos-private.h + harfbuzz-gsub.c + harfbuzz-gsub.h + harfbuzz-gsub-private.h + harfbuzz.h + harfbuzz-hangul.c + harfbuzz-hebrew.c + harfbuzz-impl.c + harfbuzz-impl.h + harfbuzz-indic.cpp + harfbuzz-khmer.c + harfbuzz-myanmar.c + harfbuzz-open.c + harfbuzz-open.h + harfbuzz-open-private.h + harfbuzz-shape.h + harfbuzz-shaper-all.cpp + harfbuzz-shaper.cpp + harfbuzz-shaper.h + harfbuzz-shaper-private.h + harfbuzz-stream.c + harfbuzz-stream.h + harfbuzz-stream-private.h + harfbuzz-thai.c + harfbuzz-tibetan.c + Makefile.am +2 tests/ +0 linebreaking/ +0 .gitignore + harfbuzz-qt.cpp + main.cpp + Makefile.am +2 Makefile.am + shaping/ +0 .gitignore + main.cpp + Makefile.am + README +4 javascriptcore/ +0 JavaScriptCore/ +0 API/ +0 APICast.h + JavaScriptCore.h + JavaScript.h + JSBase.cpp + JSBase.h + JSBasePrivate.h + JSCallbackConstructor.cpp + JSCallbackConstructor.h + JSCallbackFunction.cpp + JSCallbackFunction.h + JSCallbackObject.cpp + JSCallbackObjectFunctions.h + JSCallbackObject.h + JSClassRef.cpp + JSClassRef.h + JSContextRef.cpp + JSContextRef.h + JSObjectRef.cpp + JSObjectRef.h + JSProfilerPrivate.cpp + JSProfilerPrivate.h + JSRetainPtr.h + JSStringRefBSTR.cpp + JSStringRefBSTR.h + JSStringRefCF.cpp + JSStringRefCF.h + JSStringRef.cpp + JSStringRef.h + JSValueRef.cpp + JSValueRef.h + OpaqueJSString.cpp + OpaqueJSString.h + WebKitAvailability.h +2 assembler/ +0 AbstractMacroAssembler.h + ARMAssembler.cpp + ARMAssembler.h + ARMv7Assembler.h + AssemblerBuffer.h + AssemblerBufferWithConstantPool.h + CodeLocation.h + LinkBuffer.h + MacroAssemblerARM.cpp + MacroAssemblerARM.h + MacroAssemblerARMv7.h + MacroAssemblerCodeRef.h + MacroAssembler.h + MacroAssemblerX86_64.h + MacroAssemblerX86Common.h + MacroAssemblerX86.h + RepatchBuffer.h + X86Assembler.h +2 AUTHORS + bytecode/ +0 CodeBlock.cpp + CodeBlock.h + EvalCodeCache.h + Instruction.h + JumpTable.cpp + JumpTable.h + Opcode.cpp + Opcode.h + SamplingTool.cpp + SamplingTool.h + StructureStubInfo.cpp + StructureStubInfo.h +2 bytecompiler/ +0 BytecodeGenerator.cpp + BytecodeGenerator.h + Label.h + LabelScope.h + RegisterID.h +2 ChangeLog +0 -2002-12-03 + -2003-10-25 + -2007-10-14 + -2008-08-10 + -2009-06-16 +2 config.h + COPYING.LIB + create_hash_table + debugger/ +0 DebuggerActivation.cpp + DebuggerActivation.h + DebuggerCallFrame.cpp + DebuggerCallFrame.h + Debugger.cpp + Debugger.h +2 DerivedSources.make + docs/ +0 make-bytecode-docs.pl +2 ForwardingHeaders/ +0 JavaScriptCore/ +0 APICast.h + JavaScriptCore.h + JavaScript.h + JSBase.h + JSContextRef.h + JSObjectRef.h + JSRetainPtr.h + JSStringRefCF.h + JSStringRef.h + JSValueRef.h + OpaqueJSString.h + WebKitAvailability.h +3 generated/ +0 ArrayPrototype.lut.h + chartables.c + DatePrototype.lut.h + Grammar.cpp + Grammar.h + JSONObject.lut.h + Lexer.lut.h + MathObject.lut.h + NumberConstructor.lut.h + RegExpConstructor.lut.h + RegExpObject.lut.h + StringPrototype.lut.h +2 headers.pri + Info.plist + interpreter/ +0 CachedCall.h + CallFrameClosure.h + CallFrame.cpp + CallFrame.h + Interpreter.cpp + Interpreter.h + RegisterFile.cpp + RegisterFile.h + Register.h +2 JavaScriptCore.gypi + JavaScriptCore.order + JavaScriptCorePrefix.h + JavaScriptCore.pri + jit/ +0 ExecutableAllocator.cpp + ExecutableAllocatorFixedVMPool.cpp + ExecutableAllocator.h + ExecutableAllocatorPosix.cpp + ExecutableAllocatorWin.cpp + JITArithmetic.cpp + JITCall.cpp + JITCode.h + JIT.cpp + JIT.h + JITInlineMethods.h + JITOpcodes.cpp + JITPropertyAccess.cpp + JITStubCall.h + JITStubs.cpp + JITStubs.h +2 jsc.cpp + make-generated-sources.sh + os-win32/ +0 stdbool.h + stdint.h +2 parser/ +0 Grammar.y + Keywords.table + Lexer.cpp + Lexer.h + NodeConstructors.h + NodeInfo.h + Nodes.cpp + Nodes.h + ParserArena.cpp + ParserArena.h + Parser.cpp + Parser.h + ResultType.h + SourceCode.h + SourceProvider.h +2 pcre/ +0 AUTHORS + COPYING + dftables + pcre_compile.cpp + pcre_exec.cpp + pcre.h + pcre_internal.h + pcre.pri + pcre_tables.cpp + pcre_ucp_searchfuncs.cpp + pcre_xclass.cpp + ucpinternal.h + ucptable.cpp +2 profiler/ +0 CallIdentifier.h + HeavyProfile.cpp + HeavyProfile.h + Profile.cpp + ProfileGenerator.cpp + ProfileGenerator.h + Profile.h + ProfileNode.cpp + ProfileNode.h + Profiler.cpp + Profiler.h + ProfilerServer.h + ProfilerServer.mm + TreeProfile.cpp + TreeProfile.h +2 runtime/ +0 ArgList.cpp + ArgList.h + Arguments.cpp + Arguments.h + ArrayConstructor.cpp + ArrayConstructor.h + ArrayPrototype.cpp + ArrayPrototype.h + BatchedTransitionOptimizer.h + BooleanConstructor.cpp + BooleanConstructor.h + BooleanObject.cpp + BooleanObject.h + BooleanPrototype.cpp + BooleanPrototype.h + CallData.cpp + CallData.h + ClassInfo.h + Collector.cpp + Collector.h + CollectorHeapIterator.h + CommonIdentifiers.cpp + CommonIdentifiers.h + Completion.cpp + Completion.h + ConstructData.cpp + ConstructData.h + DateConstructor.cpp + DateConstructor.h + DateConversion.cpp + DateConversion.h + DateInstance.cpp + DateInstance.h + DatePrototype.cpp + DatePrototype.h + ErrorConstructor.cpp + ErrorConstructor.h + Error.cpp + Error.h + ErrorInstance.cpp + ErrorInstance.h + ErrorPrototype.cpp + ErrorPrototype.h + ExceptionHelpers.cpp + ExceptionHelpers.h + Executable.cpp + Executable.h + FunctionConstructor.cpp + FunctionConstructor.h + FunctionPrototype.cpp + FunctionPrototype.h + GetterSetter.cpp + GetterSetter.h + GlobalEvalFunction.cpp + GlobalEvalFunction.h + Identifier.cpp + Identifier.h + InitializeThreading.cpp + InitializeThreading.h + InternalFunction.cpp + InternalFunction.h + JSActivation.cpp + JSActivation.h + JSAPIValueWrapper.cpp + JSAPIValueWrapper.h + JSArray.cpp + JSArray.h + JSByteArray.cpp + JSByteArray.h + JSCell.cpp + JSCell.h + JSFunction.cpp + JSFunction.h + JSGlobalData.cpp + JSGlobalData.h + JSGlobalObject.cpp + JSGlobalObjectFunctions.cpp + JSGlobalObjectFunctions.h + JSGlobalObject.h + JSImmediate.cpp + JSImmediate.h + JSLock.cpp + JSLock.h + JSNotAnObject.cpp + JSNotAnObject.h + JSNumberCell.cpp + JSNumberCell.h + JSObject.cpp + JSObject.h + JSONObject.cpp + JSONObject.h + JSPropertyNameIterator.cpp + JSPropertyNameIterator.h + JSStaticScopeObject.cpp + JSStaticScopeObject.h + JSString.cpp + JSString.h + JSType.h + JSTypeInfo.h + JSValue.cpp + JSValue.h + JSVariableObject.cpp + JSVariableObject.h + JSWrapperObject.cpp + JSWrapperObject.h + LiteralParser.cpp + LiteralParser.h + Lookup.cpp + Lookup.h + MarkStack.cpp + MarkStack.h + MarkStackPosix.cpp + MarkStackWin.cpp + MathObject.cpp + MathObject.h + NativeErrorConstructor.cpp + NativeErrorConstructor.h + NativeErrorPrototype.cpp + NativeErrorPrototype.h + NativeFunctionWrapper.h + NumberConstructor.cpp + NumberConstructor.h + NumberObject.cpp + NumberObject.h + NumberPrototype.cpp + NumberPrototype.h + NumericStrings.h + ObjectConstructor.cpp + ObjectConstructor.h + ObjectPrototype.cpp + ObjectPrototype.h + Operations.cpp + Operations.h + PropertyDescriptor.cpp + PropertyDescriptor.h + PropertyMapHashTable.h + PropertyNameArray.cpp + PropertyNameArray.h + PropertySlot.cpp + PropertySlot.h + Protect.h + PrototypeFunction.cpp + PrototypeFunction.h + PutPropertySlot.h + RegExpConstructor.cpp + RegExpConstructor.h + RegExp.cpp + RegExp.h + RegExpMatchesArray.h + RegExpObject.cpp + RegExpObject.h + RegExpPrototype.cpp + RegExpPrototype.h + ScopeChain.cpp + ScopeChain.h + ScopeChainMark.h + SmallStrings.cpp + SmallStrings.h + StringConstructor.cpp + StringConstructor.h + StringObject.cpp + StringObject.h + StringObjectThatMasqueradesAsUndefined.h + StringPrototype.cpp + StringPrototype.h + StructureChain.cpp + StructureChain.h + Structure.cpp + Structure.h + StructureTransitionTable.h + SymbolTable.h + TimeoutChecker.cpp + TimeoutChecker.h + Tracing.h + UString.cpp + UString.h +2 THANKS + wrec/ +0 CharacterClassConstructor.cpp + CharacterClassConstructor.h + CharacterClass.cpp + CharacterClass.h + Escapes.h + Quantifier.h + WREC.cpp + WRECFunctors.cpp + WRECFunctors.h + WRECGenerator.cpp + WRECGenerator.h + WREC.h + WRECParser.cpp + WRECParser.h +2 wscript + wtf/ +0 AlwaysInline.h + ASCIICType.h + Assertions.cpp + Assertions.h + AVLTree.h + ByteArray.cpp + ByteArray.h + CONTRIBUTORS.pthreads-win32 + CrossThreadRefCounted.h + CurrentTime.cpp + CurrentTime.h + DateMath.cpp + DateMath.h + Deque.h + DisallowCType.h + dtoa.cpp + dtoa.h + FastAllocBase.h + FastMalloc.cpp + FastMalloc.h + Forward.h + GetPtr.h + GOwnPtr.cpp + GOwnPtr.h + HashCountedSet.h + HashFunctions.h + HashIterators.h + HashMap.h + HashSet.h + HashTable.cpp + HashTable.h + HashTraits.h + ListHashSet.h + ListRefPtr.h + Locker.h + MainThread.cpp + MainThread.h + MallocZoneSupport.h + MathExtras.h + MessageQueue.h + Noncopyable.h + NotFound.h + OwnArrayPtr.h + OwnFastMallocPtr.h + OwnPtrCommon.h + OwnPtr.h + OwnPtrWin.cpp + PassOwnPtr.h + PassRefPtr.h + Platform.h + PossiblyNull.h + PtrAndFlags.h + qt/ +0 MainThreadQt.cpp + ThreadingQt.cpp +2 RandomNumber.cpp + RandomNumber.h + RandomNumberSeed.h + RefCounted.h + RefCountedLeakCounter.cpp + RefCountedLeakCounter.h + RefPtr.h + RefPtrHashMap.h + RetainPtr.h + SegmentedVector.h + StdLibExtras.h + StringExtras.h + TCPackedCache.h + TCPageMap.h + TCSpinLock.h + TCSystemAlloc.cpp + TCSystemAlloc.h + Threading.cpp + Threading.h + ThreadingNone.cpp + ThreadingPthreads.cpp + ThreadingWin.cpp + ThreadSpecific.h + ThreadSpecificWin.cpp + TypeTraits.cpp + TypeTraits.h + unicode/ +0 CollatorDefault.cpp + Collator.h + glib/ +0 UnicodeGLib.cpp + UnicodeGLib.h + UnicodeMacrosFromICU.h +2 icu/ +0 CollatorICU.cpp + UnicodeIcu.h +2 qt4/ +0 UnicodeQt4.h +2 Unicode.h + UTF8.cpp + UTF8.h + wince/ +0 UnicodeWince.cpp + UnicodeWince.h +3 UnusedParam.h + Vector.h + VectorTraits.h + VMTags.h + wince/ +0 FastMallocWince.h + MemoryManager.cpp + MemoryManager.h + mt19937ar.c +3 yarr/ +0 RegexCompiler.cpp + RegexCompiler.h + RegexInterpreter.cpp + RegexInterpreter.h + RegexJIT.cpp + RegexJIT.h + RegexParser.h + RegexPattern.h +3 VERSION + WebKit.pri +2 libjpeg/ +0 change.log + coderules.doc + filelist.doc + install.doc + jcapimin.c + jcapistd.c + jccoefct.c + jccolor.c + jcdctmgr.c + jchuff.c + jchuff.h + jcinit.c + jcmainct.c + jcmarker.c + jcmaster.c + jcomapi.c + jconfig.bcc + jconfig.cfg + jconfig.dj + jconfig.doc + jconfig.h + jconfig.mac + jconfig.manx + jconfig.mc6 + jconfig.sas + jconfig.st + jconfig.vc + jconfig.vms + jconfig.wat + jcparam.c + jcphuff.c + jcprepct.c + jcsample.c + jctrans.c + jdapimin.c + jdapistd.c + jdatadst.c + jdatasrc.c + jdcoefct.c + jdcolor.c + jdct.h + jddctmgr.c + jdhuff.c + jdhuff.h + jdinput.c + jdmainct.c + jdmarker.c + jdmaster.c + jdmerge.c + jdphuff.c + jdpostct.c + jdsample.c + jdtrans.c + jerror.c + jerror.h + jfdctflt.c + jfdctfst.c + jfdctint.c + jidctflt.c + jidctfst.c + jidctint.c + jidctred.c + jinclude.h + jmemmgr.c + jmemnobs.c + jmemsys.h + jmorecfg.h + jpegint.h + jpeglib.h + jquant1.c + jquant2.c + jutils.c + jversion.h + libjpeg.doc + makefile.ansi + makefile.bcc + makefile.cfg + makefile.dj + makefile.manx + makefile.mc6 + makefile.mms + makefile.sas + makefile.unix + makefile.vc + makefile.vms + makefile.wat + README + structure.doc + usage.doc + wizard.doc +2 libmng/ +0 CHANGES + doc/ +0 doc.readme + libmng.txt + man/ +0 jng.5 + libmng.3 + mng.5 +2 misc/ +0 magic.dif +2 Plan1.png + Plan2.png + rpm/ +0 libmng-1.0.10-rhconf.patch + libmng.spec +3 libmng_callback_xs.c + libmng_chunk_descr.c + libmng_chunk_descr.h + libmng_chunk_io.c + libmng_chunk_io.h + libmng_chunk_prc.c + libmng_chunk_prc.h + libmng_chunks.h + libmng_chunk_xs.c + libmng_cms.c + libmng_cms.h + libmng_conf.h + libmng_data.h + libmng_display.c + libmng_display.h + libmng_dither.c + libmng_dither.h + libmng_error.c + libmng_error.h + libmng_filter.c + libmng_filter.h + libmng.h + libmng_hlapi.c + libmng_jpeg.c + libmng_jpeg.h + libmng_memory.h + libmng_object_prc.c + libmng_object_prc.h + libmng_objects.h + libmng_pixels.c + libmng_pixels.h + libmng_prop_xs.c + libmng_read.c + libmng_read.h + libmng_trace.c + libmng_trace.h + libmng_types.h + libmng_write.c + libmng_write.h + libmng_zlib.c + libmng_zlib.h + LICENSE + makefiles/ +0 configure.in + Makefile.am + makefile.bcb3 + makefile.dj + makefile.linux + makefile.mingw +0 dll +2 makefile.qnx + makefile.unix + makefile.vcwin32 + README +2 README +0 .autoconf + .config + .contrib + .dll + .examples + .footprint + .packaging +2 unmaintained/ +0 autogen.sh +3 libpng/ +0 ANNOUNCE + CHANGES + configure + example.c + INSTALL + KNOWNBUG + libpng-1.2.40.txt + libpng.3 + libpngpf.3 + LICENSE + png.5 + pngbar.jpg + pngbar.png + png.c + pngconf.h + pngerror.c + pnggccrd.c + pngget.c + png.h + pngmem.c + pngnow.png + pngpread.c + pngread.c + pngrio.c + pngrtran.c + pngrutil.c + pngset.c + pngtest.c + pngtest.png + pngtrans.c + pngvcrd.c + pngwio.c + pngwrite.c + pngwtran.c + pngwutil.c + projects/ +0 beos/ +0 x86-shared.proj + x86-shared.txt + x86-static.proj + x86-static.txt +2 cbuilder5/ +0 libpng.bpf + libpng.bpg + libpng.bpr + libpng.cpp + libpng.readme.txt + libpngstat.bpf + libpngstat.bpr + zlib.readme.txt +2 netware.txt + visualc6/ +0 libpng.dsp + libpng.dsw + pngtest.dsp + README.txt +2 visualc71/ +0 libpng.sln + libpng.vcproj + pngtest.vcproj + PRJ0041.mak + README.txt + README_zlib.txt + zlib.vcproj +2 wince.txt +2 README + scripts/ +0 CMakeLists.txt + descrip.mms + libpng-config-body.in + libpng-config-head.in + libpng-config.in + libpng.icc + libpng.pc-configure.in + libpng.pc.in + makefile.32sunu + makefile.64sunu + makefile.acorn + makefile.aix + makefile.amiga + makefile.atari + makefile.bc32 + makefile.beos + makefile.bor + makefile.cygwin + makefile.darwin + makefile.dec + makefile.dj2 + makefile.elf + makefile.freebsd + makefile.gcc + makefile.gcmmx + makefile.hp64 + makefile.hpgcc + makefile.hpux + makefile.ibmc + makefile.intel + makefile.knr + makefile.linux + makefile.mingw + makefile.mips + makefile.msc + makefile.ne12bsd + makefile.netbsd + makefile.nommx + makefile.openbsd + makefile.os2 + makefile.sco + makefile.sggcc + makefile.sgi + makefile.so9 + makefile.solaris +0 -x86 +2 makefile.std + makefile.sunos + makefile.tc3 + makefile.vcawin32 + makefile.vcwin32 + makefile.watcom + makevms.com + pngos2.def + pngw32.def + pngw32.rc + SCOPTIONS.ppc + smakefile.ppc +2 TODO + Y2KINFO +2 libtiff/ +0 aclocal.m4 + autogen.sh + ChangeLog + config/ +0 compile + config.guess + config.sub + depcomp + install-sh + ltmain.sh + missing + mkinstalldirs +2 configure +0 .ac +2 COPYRIGHT + HOWTO-RELEASE + html/ +0 addingtags.html + bugs.html + build.html + contrib.html + document.html + images/ +0 back.gif + bali.jpg + cat.gif + cover.jpg + cramps.gif + dave.gif +2 images.html + images/info.gif + images/jello.jpg + images/jim.gif + images/Makefile.am + images/Makefile.in + images/note.gif + images/oxford.gif + images/quad.jpg + images/ring.gif + images/smallliz.jpg + images/strike.gif + images/warning.gif + index.html + internals.html + intro.html + libtiff.html + Makefile.am + Makefile.in + man/ +0 fax2ps.1.html + fax2tiff.1.html + gif2tiff.1.html + index.html + libtiff.3tiff.html + Makefile.am + Makefile.in + pal2rgb.1.html + ppm2tiff.1.html + ras2tiff.1.html + raw2tiff.1.html + rgb2ycbcr.1.html + sgi2tiff.1.html + thumbnail.1.html + tiff2bw.1.html + tiff2pdf.1.html + tiff2ps.1.html + tiff2rgba.1.html + TIFFbuffer.3tiff.html + TIFFClose.3tiff.html + tiffcmp.1.html + TIFFcodec.3tiff.html + TIFFcolor.3tiff.html + tiffcp.1.html + TIFFDataWidth.3tiff.html + tiffdither.1.html + tiffdump.1.html + TIFFError.3tiff.html + TIFFFlush.3tiff.html + TIFFGetField.3tiff.html + tiffgt.1.html + tiffinfo.1.html + tiffmedian.1.html + TIFFmemory.3tiff.html + TIFFOpen.3tiff.html + TIFFPrintDirectory.3tiff.html + TIFFquery.3tiff.html + TIFFReadDirectory.3tiff.html + TIFFReadEncodedStrip.3tiff.html + TIFFReadEncodedTile.3tiff.html + TIFFReadRawStrip.3tiff.html + TIFFReadRawTile.3tiff.html + TIFFReadRGBAImage.3tiff.html + TIFFReadRGBAStrip.3tiff.html + TIFFReadRGBATile.3tiff.html + TIFFReadScanline.3tiff.html + TIFFReadTile.3tiff.html + TIFFRGBAImage.3tiff.html + tiffset.1.html + TIFFSetDirectory.3tiff.html + TIFFSetField.3tiff.html + TIFFsize.3tiff.html + tiffsplit.1.html + TIFFstrip.3tiff.html + tiffsv.1.html + TIFFswab.3tiff.html + TIFFtile.3tiff.html + TIFFWarning.3tiff.html + TIFFWriteDirectory.3tiff.html + TIFFWriteEncodedStrip.3tiff.html + TIFFWriteEncodedTile.3tiff.html + TIFFWriteRawStrip.3tiff.html + TIFFWriteRawTile.3tiff.html + TIFFWriteScanline.3tiff.html + TIFFWriteTile.3tiff.html +2 misc.html + support.html + TIFFTechNote2.html + tools.html + v3.4beta007.html + v3.4beta016.html + v3.4beta018.html + v3.4beta024.html + v3.4beta028.html + v3.4beta029.html + v3.4beta031.html + v3.4beta032.html + v3.4beta033.html + v3.4beta034.html + v3.4beta035.html + v3.4beta036.html + v3.5.1.html + v3.5.2.html + v3.5.3.html + v3.5.4.html + v3.5.5.html + v3.5.6-beta.html + v3.5.7.html + v3.6.0.html + v3.6.1.html + v3.7.0alpha.html + v3.7.0beta2.html + v3.7.0beta.html + v3.7.0.html + v3.7.1.html + v3.7.2.html + v3.7.3.html + v3.7.4.html + v3.8.0.html + v3.8.1.html + v3.8.2.html +2 libtiff/ +0 libtiff.def + Makefile.am + Makefile.in + Makefile.vc + mkg3states.c + SConstruct + t4.h + tif_acorn.c + tif_apple.c + tif_atari.c + tif_aux.c + tif_close.c + tif_codec.c + tif_color.c + tif_compress.c + tif_config.h +0 .in + .vc +2 tif_dir.c + tif_dir.h + tif_dirinfo.c + tif_dirread.c + tif_dirwrite.c + tif_dumpmode.c + tif_error.c + tif_extension.c + tif_fax3.c + tif_fax3.h + tif_fax3sm.c + tiffconf.h +0 .in + .vc +2 tiff.h + tiffio.h +0 xx +2 tiffiop.h + tif_flush.c + tiffvers.h + tif_getimage.c + tif_jpeg.c + tif_luv.c + tif_lzw.c + tif_msdos.c + tif_next.c + tif_ojpeg.c + tif_open.c + tif_packbits.c + tif_pixarlog.c + tif_predict.c + tif_predict.h + tif_print.c + tif_read.c + tif_stream.cxx + tif_strip.c + tif_swab.c + tif_thunder.c + tif_tile.c + tif_unix.c + tif_version.c + tif_warning.c + tif_win32.c + tif_win3.c + tif_write.c + tif_zip.c + uvcode.h +2 m4/ +0 acinclude.m4 + libtool.m4 + ltoptions.m4 + ltsugar.m4 + ltversion.m4 +2 Makefile.am + Makefile.in + Makefile.vc + nmake.opt + port/ +0 dummy.c + getopt.c + lfind.c + Makefile.am + Makefile.in + Makefile.vc + strcasecmp.c + strtoul.c +2 README + RELEASE-DATE + SConstruct + test/ +0 ascii_tag.c + check_tag.c + long_tag.c + Makefile.am + Makefile.in + short_tag.c + strip.c + strip_rw.c + test_arrays.c + test_arrays.h +2 TODO + VERSION +2 Makefile + md4/ +0 md4.cpp + md4.h +2 md5/ +0 md5.cpp + md5.h +2 patches/ +0 freetype-2.3.5-config.patch + freetype-2.3.6-ascii.patch + freetype-2.3.6-vxworks.patch + libjpeg-6b-config.patch + libjpeg-6b-vxworks.patch + libmng-1.0.10-endless-loop.patch + libpng-1.2.20-elf-visibility.patch + libpng-1.2.20-vxworks.patch + libtiff-3.8.2-config.patch + libtiff-3.8.2-vxworks.patch + sqlite-3.5.6-config.patch + sqlite-3.5.6-vxworks.patch + sqlite-3.5.6-wince.patch + zlib-1.2.3-elf-visibility.patch +2 phonon/ +0 CMakeLists.txt + COPYING.LIB + ds9/ +0 abstractvideorenderer.cpp + abstractvideorenderer.h + audiooutput.cpp + audiooutput.h + backend.cpp + backend.h + backendnode.cpp + backendnode.h + CMakeLists.txt + compointer.h + ConfigureChecks.cmake + ds9.desktop + effect.cpp + effect.h + fakesource.cpp + fakesource.h + iodevicereader.cpp + iodevicereader.h + lgpl-2.1.txt + lgpl-3.txt + mediagraph.cpp + mediagraph.h + mediaobject.cpp + mediaobject.h + phononds9_namespace.h + qasyncreader.cpp + qasyncreader.h + qaudiocdreader.cpp + qaudiocdreader.h + qbasefilter.cpp + qbasefilter.h + qmeminputpin.cpp + qmeminputpin.h + qpin.cpp + qpin.h + videorenderer_soft.cpp + videorenderer_soft.h + videorenderer_vmr9.cpp + videorenderer_vmr9.h + videowidget.cpp + videowidget.h + volumeeffect.cpp + volumeeffect.h +2 gstreamer/ +0 abstractrenderer.cpp + abstractrenderer.h + alsasink2.c + alsasink2.h + artssink.cpp + artssink.h + audioeffect.cpp + audioeffect.h + audiooutput.cpp + audiooutput.h + backend.cpp + backend.h + CMakeLists.txt + common.h + ConfigureChecks.cmake + devicemanager.cpp + devicemanager.h + effect.cpp + effect.h + effectmanager.cpp + effectmanager.h + glrenderer.cpp + glrenderer.h + gsthelper.cpp + gsthelper.h + gstreamer.desktop + lgpl-2.1.txt + lgpl-3.txt + medianode.cpp + medianodeevent.cpp + medianodeevent.h + medianode.h + mediaobject.cpp + mediaobject.h + message.cpp + message.h + Messages.sh + phononsrc.cpp + phononsrc.h + qwidgetvideosink.cpp + qwidgetvideosink.h + streamreader.cpp + streamreader.h + videowidget.cpp + videowidget.h + volumefadereffect.cpp + volumefadereffect.h + widgetrenderer.cpp + widgetrenderer.h + x11renderer.cpp + x11renderer.h +2 includes/ +0 CMakeLists.txt + Phonon/ +0 AbstractAudioOutput + AbstractMediaStream + AbstractVideoOutput + AddonInterface + AudioDevice +0 Enumerator +2 AudioOutput +0 Device +0 Model +2 Interface +2 BackendCapabilities + BackendInterface + Effect +0 Description +0 Model +2 Interface + Parameter + Widget +2 Experimental/ +0 AbstractVideoDataOutput + AudioDataOutput + SnapshotInterface + VideoDataOutput +0 Interface +2 VideoFrame +0 2 +2 Visualization +2 Global + MediaController + MediaNode + MediaObject +0 Interface +2 MediaSource + ObjectDescription +0 Model +2 Path + PlatformPlugin + SeekSlider + StreamInterface + VideoPlayer + VideoWidget +0 Interface +2 VolumeFaderEffect + VolumeFaderInterface + VolumeSlider +3 mmf/ +0 abstractaudioeffect.cpp + abstractaudioeffect.h + abstractmediaplayer.cpp + abstractmediaplayer.h + abstractplayer.cpp + abstractplayer.h + ancestormovemonitor.cpp + ancestormovemonitor.h + audioequalizer.cpp + audioequalizer.h + audiooutput.cpp + audiooutput.h + audioplayer.cpp + audioplayer.h + backend.cpp + backend.h + bassboost.cpp + bassboost.h + defs.h + dummyplayer.cpp + dummyplayer.h + effectfactory.cpp + effectfactory.h + mediaobject.cpp + mediaobject.h + mmf_medianode.cpp + mmf_medianode.h + mmf_videoplayer.cpp + mmf_videoplayer.h + objectdump.cpp + objectdump.h + objectdump_symbian.cpp + objectdump_symbian.h + objecttree.cpp + objecttree.h + utils.cpp + utils.h + videooutput.cpp + videooutput.h + videooutputobserver.h + videowidget.cpp + videowidget.h + volumeobserver.h +2 phonon/ +0 abstractaudiooutput.cpp + abstractaudiooutput.h + abstractaudiooutput_p.cpp + abstractaudiooutput_p.h + abstractmediastream.cpp + abstractmediastream.h + abstractmediastream_p.h + abstractvideooutput.cpp + abstractvideooutput.h + abstractvideooutput_p.cpp + abstractvideooutput_p.h + addoninterface.h + audiooutputadaptor.cpp + audiooutputadaptor_p.h + audiooutput.cpp + audiooutput.h + audiooutputinterface.cpp + audiooutputinterface.h + audiooutput_p.h + backendcapabilities.cpp + backendcapabilities.h + backendcapabilities_p.h + backend.dox + backendinterface.h + BUGS + CMakeLists.txt + effect.cpp + effect.h + effectinterface.h + effectparameter.cpp + effectparameter.h + effectparameter_p.h + effect_p.h + effectwidget.cpp + effectwidget.h + effectwidget_p.h + extractmethodcalls.rb + factory.cpp + factory_p.h + frontendinterface_p.h + globalconfig.cpp + globalconfig_p.h + globalstatic_p.h + IDEAS + iodevicestream.cpp + iodevicestream_p.h + .krazy + mediacontroller.cpp + mediacontroller.h + medianode.cpp + medianodedestructionhandler_p.h + medianode.h + medianode_p.h + mediaobject.cpp + mediaobject.dox + mediaobject.h + mediaobjectinterface.h + mediaobject_p.h + mediasource.cpp + mediasource.h + mediasource_p.h + Messages.sh + objectdescription.cpp + objectdescription.h + objectdescriptionmodel.cpp + objectdescriptionmodel.h + objectdescriptionmodel_p.h + objectdescription_p.h + org.kde.Phonon.AudioOutput.xml + path.cpp + path.h + path_p.h +2 phonon.pc.cmake + phonon/phonondefs.h + phonon/phonondefs_p.h + phonon/phonon_export.h + phonon/phononnamespace.cpp + phonon/phononnamespace.h +0 .in +2 phonon/phononnamespace_p.h + phonon/platform.cpp + phonon/platform_p.h + phonon/platformplugin.h + phonon/preprocessandextract.sh + phonon/qsettingsgroup_p.h + phonon/seekslider.cpp + phonon/seekslider.h + phonon/seekslider_p.h + phonon/streaminterface.cpp + phonon/streaminterface.h + phonon/streaminterface_p.h + phonon/stream-thoughts + phonon/TODO + phonon/videoplayer.cpp + phonon/videoplayer.h + phonon/videowidget.cpp + phonon/videowidget.h + phonon/videowidgetinterface.h + phonon/videowidget_p.h + phonon/volumefadereffect.cpp + phonon/volumefadereffect.h + phonon/volumefadereffect_p.h + phonon/volumefaderinterface.h + phonon/volumeslider.cpp + phonon/volumeslider.h + phonon/volumeslider_p.h + qt7/ +0 audioconnection.h + audioconnection.mm + audiodevice.h + audiodevice.mm + audioeffects.h + audioeffects.mm + audiograph.h + audiograph.mm + audiomixer.h + audiomixer.mm + audionode.h + audionode.mm + audiooutput.h + audiooutput.mm + audiopartoutput.h + audiopartoutput.mm + audiosplitter.h + audiosplitter.mm + backend.h + backendheader.h + backendheader.mm + backendinfo.h + backendinfo.mm + backend.mm + CMakeLists.txt + ConfigureChecks.cmake + lgpl-2.1.txt + lgpl-3.txt + medianodeevent.h + medianodeevent.mm + medianode.h + medianode.mm + medianodevideopart.h + medianodevideopart.mm + mediaobjectaudionode.h + mediaobjectaudionode.mm + mediaobject.h + mediaobject.mm + quicktimeaudioplayer.h + quicktimeaudioplayer.mm + quicktimemetadata.h + quicktimemetadata.mm + quicktimestreamreader.h + quicktimestreamreader.mm + quicktimevideoplayer.h + quicktimevideoplayer.mm + videoeffect.h + videoeffect.mm + videoframe.h + videoframe.mm + videowidget.h + videowidget.mm +2 waveout/ +0 audiooutput.cpp + audiooutput.h + backend.cpp + backend.h + mediaobject.cpp + mediaobject.h +3 powervr/ +0 pvr2d.h + wsegl.h +2 ptmalloc/ +0 ChangeLog + COPYRIGHT + lran2.h + Makefile + malloc-2.8.3.h + malloc.c + malloc-private.h + ptmalloc3.c + README + sysdeps/ +0 generic/ +0 atomic.h + malloc-machine.h + thread-st.h +2 pthread/ +0 malloc-machine.h + thread-st.h +2 solaris/ +0 malloc-machine.h + thread-st.h +2 sproc/ +0 malloc-machine.h + thread-st.h +4 README + sha1/ +0 sha1.cpp +2 sqlite/ +0 shell.c + sqlite3.c + sqlite3.h +2 webkit/ +0 ChangeLog + .gitignore + JavaScriptCore/ +0 API/ +0 APICast.h + JavaScriptCore.h + JavaScript.h + JSBase.cpp + JSBase.h + JSBasePrivate.h + JSCallbackConstructor.cpp + JSCallbackConstructor.h + JSCallbackFunction.cpp + JSCallbackFunction.h + JSCallbackObject.cpp + JSCallbackObjectFunctions.h + JSCallbackObject.h + JSClassRef.cpp + JSClassRef.h + JSContextRef.cpp + JSContextRef.h + JSContextRefPrivate.h + JSObjectRef.cpp + JSObjectRef.h + JSProfilerPrivate.cpp + JSProfilerPrivate.h + JSRetainPtr.h + JSStringRefBSTR.cpp + JSStringRefBSTR.h + JSStringRefCF.cpp + JSStringRefCF.h + JSStringRef.cpp + JSStringRef.h + JSValueRef.cpp + JSValueRef.h + OpaqueJSString.cpp + OpaqueJSString.h + WebKitAvailability.h +2 assembler/ +0 AbstractMacroAssembler.h + ARMAssembler.cpp + ARMAssembler.h + ARMv7Assembler.h + AssemblerBuffer.h + AssemblerBufferWithConstantPool.h + CodeLocation.h + LinkBuffer.h + MacroAssemblerARM.cpp + MacroAssemblerARM.h + MacroAssemblerARMv7.h + MacroAssemblerCodeRef.h + MacroAssembler.h + MacroAssemblerX86_64.h + MacroAssemblerX86Common.h + MacroAssemblerX86.h + RepatchBuffer.h + X86Assembler.h +2 AUTHORS + bytecode/ +0 CodeBlock.cpp + CodeBlock.h + EvalCodeCache.h + Instruction.h + JumpTable.cpp + JumpTable.h + Opcode.cpp + Opcode.h + SamplingTool.cpp + SamplingTool.h + StructureStubInfo.cpp + StructureStubInfo.h +2 bytecompiler/ +0 BytecodeGenerator.cpp + BytecodeGenerator.h + Label.h + LabelScope.h + RegisterID.h +2 ChangeLog +0 -2002-12-03 + -2003-10-25 + -2007-10-14 + -2008-08-10 + -2009-06-16 +2 config.h + COPYING.LIB + create_hash_table + debugger/ +0 DebuggerActivation.cpp + DebuggerActivation.h + DebuggerCallFrame.cpp + DebuggerCallFrame.h + Debugger.cpp + Debugger.h +2 DerivedSources.make + docs/ +0 make-bytecode-docs.pl +2 ForwardingHeaders/ +0 JavaScriptCore/ +0 APICast.h + JavaScriptCore.h + JavaScript.h + JSBase.h + JSContextRef.h + JSObjectRef.h + JSRetainPtr.h + JSStringRefCF.h + JSStringRef.h + JSValueRef.h + OpaqueJSString.h + WebKitAvailability.h +3 generated/ +0 ArrayPrototype.lut.h + chartables.c + DatePrototype.lut.h + Grammar.cpp + Grammar.h + JSONObject.lut.h + Lexer.lut.h + MathObject.lut.h + NumberConstructor.lut.h + RegExpConstructor.lut.h + RegExpObject.lut.h + StringPrototype.lut.h +2 headers.pri + Info.plist + interpreter/ +0 CachedCall.h + CallFrameClosure.h + CallFrame.cpp + CallFrame.h + Interpreter.cpp + Interpreter.h + RegisterFile.cpp + RegisterFile.h + Register.h +2 JavaScriptCore.gypi + JavaScriptCore.order + JavaScriptCorePrefix.h + JavaScriptCore.pri + JavaScriptCore.pro + jit/ +0 ExecutableAllocator.cpp + ExecutableAllocatorFixedVMPool.cpp + ExecutableAllocator.h + ExecutableAllocatorPosix.cpp + ExecutableAllocatorSymbian.cpp + ExecutableAllocatorWin.cpp + JITArithmetic.cpp + JITCall.cpp + JITCode.h + JIT.cpp + JIT.h + JITInlineMethods.h + JITOpcodes.cpp + JITPropertyAccess.cpp + JITStubCall.h + JITStubs.cpp + JITStubs.h +2 jsc.cpp + make-generated-sources.sh + os-win32/ +0 stdbool.h + stdint.h +2 parser/ +0 Grammar.y + Keywords.table + Lexer.cpp + Lexer.h + NodeConstructors.h + NodeInfo.h + Nodes.cpp + Nodes.h + ParserArena.cpp + ParserArena.h + Parser.cpp + Parser.h + ResultType.h + SourceCode.h + SourceProvider.h +2 pcre/ +0 AUTHORS + COPYING + dftables + pcre_compile.cpp + pcre_exec.cpp + pcre.h + pcre_internal.h + pcre.pri + pcre_tables.cpp + pcre_ucp_searchfuncs.cpp + pcre_xclass.cpp + ucpinternal.h + ucptable.cpp +2 profiler/ +0 CallIdentifier.h + HeavyProfile.cpp + HeavyProfile.h + Profile.cpp + ProfileGenerator.cpp + ProfileGenerator.h + Profile.h + ProfileNode.cpp + ProfileNode.h + Profiler.cpp + Profiler.h + ProfilerServer.h + ProfilerServer.mm + TreeProfile.cpp + TreeProfile.h +2 runtime/ +0 ArgList.cpp + ArgList.h + Arguments.cpp + Arguments.h + ArrayConstructor.cpp + ArrayConstructor.h + ArrayPrototype.cpp + ArrayPrototype.h + BatchedTransitionOptimizer.h + BooleanConstructor.cpp + BooleanConstructor.h + BooleanObject.cpp + BooleanObject.h + BooleanPrototype.cpp + BooleanPrototype.h + CallData.cpp + CallData.h + ClassInfo.h + Collector.cpp + Collector.h + CollectorHeapIterator.h + CommonIdentifiers.cpp + CommonIdentifiers.h + Completion.cpp + Completion.h + ConstructData.cpp + ConstructData.h + DateConstructor.cpp + DateConstructor.h + DateConversion.cpp + DateConversion.h + DateInstanceCache.h + DateInstance.cpp + DateInstance.h + DatePrototype.cpp + DatePrototype.h + ErrorConstructor.cpp + ErrorConstructor.h + Error.cpp + Error.h + ErrorInstance.cpp + ErrorInstance.h + ErrorPrototype.cpp + ErrorPrototype.h + ExceptionHelpers.cpp + ExceptionHelpers.h + Executable.cpp + Executable.h + FunctionConstructor.cpp + FunctionConstructor.h + FunctionPrototype.cpp + FunctionPrototype.h + GetterSetter.cpp + GetterSetter.h + GlobalEvalFunction.cpp + GlobalEvalFunction.h + Identifier.cpp + Identifier.h + InitializeThreading.cpp + InitializeThreading.h + InternalFunction.cpp + InternalFunction.h + JSActivation.cpp + JSActivation.h + JSAPIValueWrapper.cpp + JSAPIValueWrapper.h + JSArray.cpp + JSArray.h + JSByteArray.cpp + JSByteArray.h + JSCell.cpp + JSCell.h + JSFunction.cpp + JSFunction.h + JSGlobalData.cpp + JSGlobalData.h + JSGlobalObject.cpp + JSGlobalObjectFunctions.cpp + JSGlobalObjectFunctions.h + JSGlobalObject.h + JSImmediate.cpp + JSImmediate.h + JSLock.cpp + JSLock.h + JSNotAnObject.cpp + JSNotAnObject.h + JSNumberCell.cpp + JSNumberCell.h + JSObject.cpp + JSObject.h + JSONObject.cpp + JSONObject.h + JSPropertyNameIterator.cpp + JSPropertyNameIterator.h + JSStaticScopeObject.cpp + JSStaticScopeObject.h + JSString.cpp + JSString.h + JSType.h + JSTypeInfo.h + JSValue.cpp + JSValue.h + JSVariableObject.cpp + JSVariableObject.h + JSWrapperObject.cpp + JSWrapperObject.h + LiteralParser.cpp + LiteralParser.h + Lookup.cpp + Lookup.h + MarkStack.cpp + MarkStack.h + MarkStackPosix.cpp + MarkStackSymbian.cpp + MarkStackWin.cpp + MathObject.cpp + MathObject.h + NativeErrorConstructor.cpp + NativeErrorConstructor.h + NativeErrorPrototype.cpp + NativeErrorPrototype.h + NativeFunctionWrapper.h + NumberConstructor.cpp + NumberConstructor.h + NumberObject.cpp + NumberObject.h + NumberPrototype.cpp + NumberPrototype.h + NumericStrings.h + ObjectConstructor.cpp + ObjectConstructor.h + ObjectPrototype.cpp + ObjectPrototype.h + Operations.cpp + Operations.h + PropertyDescriptor.cpp + PropertyDescriptor.h + PropertyMapHashTable.h + PropertyNameArray.cpp + PropertyNameArray.h + PropertySlot.cpp + PropertySlot.h + Protect.h + PrototypeFunction.cpp + PrototypeFunction.h + PutPropertySlot.h + RegExpConstructor.cpp + RegExpConstructor.h + RegExp.cpp + RegExp.h + RegExpMatchesArray.h + RegExpObject.cpp + RegExpObject.h + RegExpPrototype.cpp + RegExpPrototype.h + ScopeChain.cpp + ScopeChain.h + ScopeChainMark.h + SmallStrings.cpp + SmallStrings.h + StringConstructor.cpp + StringConstructor.h + StringObject.cpp + StringObject.h + StringObjectThatMasqueradesAsUndefined.h + StringPrototype.cpp + StringPrototype.h + StructureChain.cpp + StructureChain.h + Structure.cpp + Structure.h + StructureTransitionTable.h + SymbolTable.h + TimeoutChecker.cpp + TimeoutChecker.h + Tracing.h + UString.cpp + UString.h +2 THANKS + wrec/ +0 CharacterClassConstructor.cpp + CharacterClassConstructor.h + CharacterClass.cpp + CharacterClass.h + Escapes.h + Quantifier.h + WREC.cpp + WRECFunctors.cpp + WRECFunctors.h + WRECGenerator.cpp + WRECGenerator.h + WREC.h + WRECParser.cpp + WRECParser.h +2 wscript + wtf/ +0 AlwaysInline.h + ASCIICType.h + Assertions.cpp + Assertions.h + AVLTree.h + ByteArray.cpp + ByteArray.h + CONTRIBUTORS.pthreads-win32 + CrossThreadRefCounted.h + CurrentTime.cpp + CurrentTime.h + DateMath.cpp + DateMath.h + Deque.h + DisallowCType.h + dtoa.cpp + dtoa.h + FastAllocBase.h + FastMalloc.cpp + FastMalloc.h + Forward.h + GetPtr.h + GOwnPtr.cpp + GOwnPtr.h + HashCountedSet.h + HashFunctions.h + HashIterators.h + HashMap.h + HashSet.h + HashTable.cpp + HashTable.h + HashTraits.h + ListHashSet.h + ListRefPtr.h + Locker.h + MainThread.cpp + MainThread.h + MallocZoneSupport.h + MathExtras.h + MessageQueue.h + Noncopyable.h + NotFound.h + OwnArrayPtr.h + OwnFastMallocPtr.h + OwnPtrCommon.h + OwnPtr.h + OwnPtrWin.cpp + PassOwnPtr.h + PassRefPtr.h + Platform.h + PossiblyNull.h + PtrAndFlags.h + qt/ +0 MainThreadQt.cpp + ThreadingQt.cpp +2 RandomNumber.cpp + RandomNumber.h + RandomNumberSeed.h + RefCounted.h + RefCountedLeakCounter.cpp + RefCountedLeakCounter.h + RefPtr.h + RefPtrHashMap.h + RetainPtr.h + SegmentedVector.h + StdLibExtras.h + StringExtras.h + TCPackedCache.h + TCPageMap.h + TCSpinLock.h + TCSystemAlloc.cpp + TCSystemAlloc.h + Threading.cpp + Threading.h + ThreadingNone.cpp + ThreadingPthreads.cpp + ThreadingWin.cpp + ThreadSpecific.h + ThreadSpecificWin.cpp + TypeTraits.cpp + TypeTraits.h + unicode/ +0 CollatorDefault.cpp + Collator.h + glib/ +0 UnicodeGLib.cpp + UnicodeGLib.h + UnicodeMacrosFromICU.h +2 icu/ +0 CollatorICU.cpp + UnicodeIcu.h +2 qt4/ +0 UnicodeQt4.h +2 Unicode.h + UTF8.cpp + UTF8.h + wince/ +0 UnicodeWince.cpp + UnicodeWince.h +3 UnusedParam.h + Vector.h + VectorTraits.h + VMTags.h + wince/ +0 FastMallocWince.h + MemoryManager.cpp + MemoryManager.h + mt19937ar.c +3 yarr/ +0 RegexCompiler.cpp + RegexCompiler.h + RegexInterpreter.cpp + RegexInterpreter.h + RegexJIT.cpp + RegexJIT.h + RegexParser.h + RegexPattern.h +3 VERSION + WebCore/ +0 accessibility/ +0 AccessibilityAllInOne.cpp + AccessibilityARIAGridCell.cpp + AccessibilityARIAGridCell.h + AccessibilityARIAGrid.cpp + AccessibilityARIAGrid.h + AccessibilityARIAGridRow.cpp + AccessibilityARIAGridRow.h + AccessibilityImageMapLink.cpp + AccessibilityImageMapLink.h + AccessibilityListBox.cpp + AccessibilityListBox.h + AccessibilityListBoxOption.cpp + AccessibilityListBoxOption.h + AccessibilityList.cpp + AccessibilityList.h + AccessibilityMediaControls.cpp + AccessibilityMediaControls.h + AccessibilityObject.cpp + AccessibilityObject.h + AccessibilityRenderObject.cpp + AccessibilityRenderObject.h + AccessibilitySlider.cpp + AccessibilitySlider.h + AccessibilityTableCell.cpp + AccessibilityTableCell.h + AccessibilityTableColumn.cpp + AccessibilityTableColumn.h + AccessibilityTable.cpp + AccessibilityTable.h + AccessibilityTableHeaderContainer.cpp + AccessibilityTableHeaderContainer.h + AccessibilityTableRow.cpp + AccessibilityTableRow.h + AXObjectCache.cpp + AXObjectCache.h + qt/ +0 AccessibilityObjectQt.cpp +3 bindings/ +0 js/ +0 CachedScriptSourceProvider.h + DOMObjectWithSVGContext.h + GCController.cpp + GCController.h + JSAbstractWorkerCustom.cpp + JSAttrCustom.cpp + JSAudioConstructor.cpp + JSAudioConstructor.h + JSBindingsAllInOne.cpp + JSCallbackData.cpp + JSCallbackData.h + JSCanvasArrayBufferConstructor.cpp + JSCanvasArrayBufferConstructor.h + JSCanvasArrayCustom.cpp + JSCanvasByteArrayConstructor.cpp + JSCanvasByteArrayConstructor.h + JSCanvasByteArrayCustom.cpp + JSCanvasFloatArrayConstructor.cpp + JSCanvasFloatArrayConstructor.h + JSCanvasFloatArrayCustom.cpp + JSCanvasIntArrayConstructor.cpp + JSCanvasIntArrayConstructor.h + JSCanvasIntArrayCustom.cpp + JSCanvasNumberArrayCustom.cpp + JSCanvasRenderingContext2DCustom.cpp + JSCanvasRenderingContext3DCustom.cpp + JSCanvasRenderingContextCustom.cpp + JSCanvasShortArrayConstructor.cpp + JSCanvasShortArrayConstructor.h + JSCanvasShortArrayCustom.cpp + JSCanvasUnsignedByteArrayConstructor.cpp + JSCanvasUnsignedByteArrayConstructor.h + JSCanvasUnsignedByteArrayCustom.cpp + JSCanvasUnsignedIntArrayConstructor.cpp + JSCanvasUnsignedIntArrayConstructor.h + JSCanvasUnsignedIntArrayCustom.cpp + JSCanvasUnsignedShortArrayConstructor.cpp + JSCanvasUnsignedShortArrayConstructor.h + JSCanvasUnsignedShortArrayCustom.cpp + JSCDATASectionCustom.cpp + JSClipboardCustom.cpp + JSConsoleCustom.cpp + JSCoordinatesCustom.cpp + JSCSSRuleCustom.cpp + JSCSSRuleListCustom.cpp + JSCSSStyleDeclarationCustom.cpp + JSCSSStyleDeclarationCustom.h + JSCSSValueCustom.cpp + JSCustomPositionCallback.cpp + JSCustomPositionCallback.h + JSCustomPositionErrorCallback.cpp + JSCustomPositionErrorCallback.h + JSCustomSQLStatementCallback.cpp + JSCustomSQLStatementCallback.h + JSCustomSQLStatementErrorCallback.cpp + JSCustomSQLStatementErrorCallback.h + JSCustomSQLTransactionCallback.cpp + JSCustomSQLTransactionCallback.h + JSCustomSQLTransactionErrorCallback.cpp + JSCustomSQLTransactionErrorCallback.h + JSCustomVoidCallback.cpp + JSCustomVoidCallback.h + JSCustomXPathNSResolver.cpp + JSCustomXPathNSResolver.h + JSDatabaseCustom.cpp + JSDataGridColumnListCustom.cpp + JSDataGridDataSource.cpp + JSDataGridDataSource.h + JSDedicatedWorkerContextCustom.cpp + JSDesktopNotificationsCustom.cpp + JSDocumentCustom.cpp + JSDocumentFragmentCustom.cpp + JSDOMApplicationCacheCustom.cpp + JSDOMBinding.cpp + JSDOMBinding.h + JSDOMGlobalObject.cpp + JSDOMGlobalObject.h + JSDOMWindowBase.cpp + JSDOMWindowBase.h + JSDOMWindowCustom.cpp + JSDOMWindowCustom.h + JSDOMWindowShell.cpp + JSDOMWindowShell.h + JSElementCustom.cpp + JSEventCustom.cpp + JSEventListener.cpp + JSEventListener.h + JSEventSourceConstructor.cpp + JSEventSourceConstructor.h + JSEventSourceCustom.cpp + JSEventTarget.cpp + JSEventTarget.h + JSExceptionBase.cpp + JSExceptionBase.h + JSGeolocationCustom.cpp + JSHistoryCustom.cpp + JSHistoryCustom.h + JSHTMLAllCollectionCustom.cpp + JSHTMLAppletElementCustom.cpp + JSHTMLAppletElementCustom.h + JSHTMLCanvasElementCustom.cpp + JSHTMLCollectionCustom.cpp + JSHTMLDataGridElementCustom.cpp + JSHTMLDocumentCustom.cpp + JSHTMLElementCustom.cpp + JSHTMLEmbedElementCustom.cpp + JSHTMLEmbedElementCustom.h + JSHTMLFormElementCustom.cpp + JSHTMLFrameElementCustom.cpp + JSHTMLFrameSetElementCustom.cpp + JSHTMLIFrameElementCustom.cpp + JSHTMLInputElementCustom.cpp + JSHTMLInputElementCustom.h + JSHTMLObjectElementCustom.cpp + JSHTMLObjectElementCustom.h + JSHTMLOptionsCollectionCustom.cpp + JSHTMLSelectElementCustom.cpp + JSHTMLSelectElementCustom.h + JSImageConstructor.cpp + JSImageConstructor.h + JSImageDataCustom.cpp + JSInspectedObjectWrapper.cpp + JSInspectedObjectWrapper.h + JSInspectorBackendCustom.cpp + JSInspectorCallbackWrapper.cpp + JSInspectorCallbackWrapper.h + JSJavaScriptCallFrameCustom.cpp + JSLazyEventListener.cpp + JSLazyEventListener.h + JSLocationCustom.cpp + JSLocationCustom.h + JSMessageChannelConstructor.cpp + JSMessageChannelConstructor.h + JSMessageChannelCustom.cpp + JSMessageEventCustom.cpp + JSMessagePortCustom.cpp + JSMessagePortCustom.h + JSMimeTypeArrayCustom.cpp + JSNamedNodeMapCustom.cpp + JSNavigatorCustom.cpp + JSNodeCustom.cpp + JSNodeFilterCondition.cpp + JSNodeFilterCondition.h + JSNodeFilterCustom.cpp + JSNodeIteratorCustom.cpp + JSNodeListCustom.cpp + JSOptionConstructor.cpp + JSOptionConstructor.h + JSPluginArrayCustom.cpp + JSPluginCustom.cpp + JSPluginElementFunctions.cpp + JSPluginElementFunctions.h + JSQuarantinedObjectWrapper.cpp + JSQuarantinedObjectWrapper.h + JSSharedWorkerConstructor.cpp + JSSharedWorkerConstructor.h + JSSharedWorkerCustom.cpp + JSSQLResultSetRowListCustom.cpp + JSSQLTransactionCustom.cpp + JSStorageCustom.cpp + JSStorageCustom.h + JSStyleSheetCustom.cpp + JSStyleSheetListCustom.cpp + JSSVGElementInstanceCustom.cpp + JSSVGLengthCustom.cpp + JSSVGMatrixCustom.cpp + JSSVGPathSegCustom.cpp + JSSVGPathSegListCustom.cpp + JSSVGPODTypeWrapper.h + JSSVGPointListCustom.cpp + JSSVGTransformListCustom.cpp + JSTextCustom.cpp + JSTreeWalkerCustom.cpp + JSWebKitCSSMatrixConstructor.cpp + JSWebKitCSSMatrixConstructor.h + JSWebKitPointConstructor.cpp + JSWebKitPointConstructor.h + JSWebSocketConstructor.cpp + JSWebSocketConstructor.h + JSWebSocketCustom.cpp + JSWorkerConstructor.cpp + JSWorkerConstructor.h + JSWorkerContextBase.cpp + JSWorkerContextBase.h + JSWorkerContextCustom.cpp + JSWorkerCustom.cpp + JSXMLHttpRequestConstructor.cpp + JSXMLHttpRequestConstructor.h + JSXMLHttpRequestCustom.cpp + JSXMLHttpRequestUploadCustom.cpp + JSXSLTProcessorConstructor.cpp + JSXSLTProcessorConstructor.h + JSXSLTProcessorCustom.cpp + ScheduledAction.cpp + ScheduledAction.h + ScriptArray.cpp + ScriptArray.h + ScriptCachedFrameData.cpp + ScriptCachedFrameData.h + ScriptCallFrame.cpp + ScriptCallFrame.h + ScriptCallStack.cpp + ScriptCallStack.h + ScriptController.cpp + ScriptControllerGtk.cpp + ScriptController.h + ScriptControllerHaiku.cpp + ScriptControllerMac.mm + ScriptControllerQt.cpp + ScriptControllerWin.cpp + ScriptControllerWx.cpp + ScriptEventListener.cpp + ScriptEventListener.h + ScriptFunctionCall.cpp + ScriptFunctionCall.h + ScriptInstance.h + ScriptObject.cpp + ScriptObject.h + ScriptObjectQuarantine.cpp + ScriptObjectQuarantine.h + ScriptSourceCode.h + ScriptSourceProvider.h + ScriptState.cpp + ScriptState.h + ScriptString.h + ScriptValue.cpp + ScriptValue.h + SerializedScriptValue.cpp + SerializedScriptValue.h + StringSourceProvider.h + WorkerScriptController.cpp + WorkerScriptController.h +2 ScriptControllerBase.cpp + scripts/ +0 CodeGeneratorCOM.pm + CodeGeneratorJS.pm + CodeGeneratorObjC.pm + CodeGenerator.pm + CodeGeneratorV8.pm + generate-bindings.pl + IDLParser.pm + IDLStructure.pm + InFilesParser.pm +3 bridge/ +0 c/ +0 c_class.cpp + c_class.h + c_instance.cpp + c_instance.h + c_runtime.cpp + c_runtime.h + c_utility.cpp + c_utility.h +2 IdentifierRep.cpp + IdentifierRep.h + jni/ +0 jni_class.cpp + jni_class.h + jni_instance.cpp + jni_instance.h + jni_jsobject.h + jni_jsobject.mm + jni_objc.mm + jni_runtime.cpp + jni_runtime.h + jni_utility.cpp + jni_utility.h +2 make_testbindings + npapi.h + NP_jsobject.cpp + NP_jsobject.h + npruntime.cpp + npruntime.h + npruntime_impl.h + npruntime_internal.h + npruntime_priv.h + qt/ +0 qt_class.cpp + qt_class.h + qt_instance.cpp + qt_instance.h + qt_runtime.cpp + qt_runtime.h +2 runtime_array.cpp + runtime_array.h + runtime.cpp + runtime.h + runtime_method.cpp + runtime_method.h + runtime_object.cpp + runtime_object.h + runtime_root.cpp + runtime_root.h + testbindings.cpp + testbindings.mm + testC.js + test.js + testM.js + testqtbindings.cpp +2 ChangeLog +0 -2002-12-03 + -2003-10-25 + -2005-08-23 + -2005-12-19 + -2006-05-10 + -2006-12-31 + -2007-10-14 + -2008-08-10 + -2009-06-16 +2 combine-javascript-resources + config.h + css/ +0 Counter.h + Counter.idl + CSSBorderImageValue.cpp + CSSBorderImageValue.h + CSSCanvasValue.cpp + CSSCanvasValue.h + CSSCharsetRule.cpp + CSSCharsetRule.h + CSSCharsetRule.idl + CSSComputedStyleDeclaration.cpp + CSSComputedStyleDeclaration.h + CSSCursorImageValue.cpp + CSSCursorImageValue.h + CSSFontFace.cpp + CSSFontFace.h + CSSFontFaceRule.cpp + CSSFontFaceRule.h + CSSFontFaceRule.idl + CSSFontFaceSource.cpp + CSSFontFaceSource.h + CSSFontFaceSrcValue.cpp + CSSFontFaceSrcValue.h + CSSFontSelector.cpp + CSSFontSelector.h + CSSFunctionValue.cpp + CSSFunctionValue.h + CSSGradientValue.cpp + CSSGradientValue.h + CSSGrammar.y + CSSHelper.cpp + CSSHelper.h + CSSImageGeneratorValue.cpp + CSSImageGeneratorValue.h + CSSImageValue.cpp + CSSImageValue.h + CSSImportRule.cpp + CSSImportRule.h + CSSImportRule.idl + CSSInheritedValue.cpp + CSSInheritedValue.h + CSSInitialValue.cpp + CSSInitialValue.h + CSSMediaRule.cpp + CSSMediaRule.h + CSSMediaRule.idl + CSSMutableStyleDeclaration.cpp + CSSMutableStyleDeclaration.h + CSSNamespace.h + CSSPageRule.cpp + CSSPageRule.h + CSSPageRule.idl + CSSParser.cpp + CSSParser.h + CSSParserValues.cpp + CSSParserValues.h + CSSPrimitiveValue.cpp + CSSPrimitiveValue.h + CSSPrimitiveValue.idl + CSSPrimitiveValueMappings.h + CSSProperty.cpp + CSSProperty.h + CSSPropertyLonghand.cpp + CSSPropertyLonghand.h + CSSPropertyNames.in + CSSQuirkPrimitiveValue.h + CSSReflectionDirection.h + CSSReflectValue.cpp + CSSReflectValue.h + CSSRule.cpp + CSSRule.h + CSSRule.idl + CSSRuleList.cpp + CSSRuleList.h + CSSRuleList.idl + CSSSegmentedFontFace.cpp + CSSSegmentedFontFace.h + CSSSelector.cpp + CSSSelector.h + CSSSelectorList.cpp + CSSSelectorList.h + CSSStyleDeclaration.cpp + CSSStyleDeclaration.h + CSSStyleDeclaration.idl + CSSStyleRule.cpp + CSSStyleRule.h + CSSStyleRule.idl + CSSStyleSelector.cpp + CSSStyleSelector.h + CSSStyleSheet.cpp + CSSStyleSheet.h + CSSStyleSheet.idl + CSSTimingFunctionValue.cpp + CSSTimingFunctionValue.h + CSSUnicodeRangeValue.cpp + CSSUnicodeRangeValue.h + CSSUnknownRule.h + CSSUnknownRule.idl + CSSValue.h + CSSValue.idl + CSSValueKeywords.in + CSSValueList.cpp + CSSValueList.h + CSSValueList.idl + CSSVariableDependentValue.cpp + CSSVariableDependentValue.h + CSSVariablesDeclaration.cpp + CSSVariablesDeclaration.h + CSSVariablesDeclaration.idl + CSSVariablesRule.cpp + CSSVariablesRule.h + CSSVariablesRule.idl + DashboardRegion.h + DashboardSupportCSSPropertyNames.in + FontFamilyValue.cpp + FontFamilyValue.h + FontValue.cpp + FontValue.h + html.css + make-css-file-arrays.pl + makegrammar.pl + makeprop.pl + maketokenizer + makevalues.pl + mathml.css + mediaControlsChromium.css + mediaControls.css + mediaControlsQt.css + mediaControlsQuickTime.css + Media.cpp + MediaFeatureNames.cpp + MediaFeatureNames.h + Media.h + Media.idl + MediaList.cpp + MediaList.h + MediaList.idl + MediaQuery.cpp + MediaQueryEvaluator.cpp + MediaQueryEvaluator.h + MediaQueryExp.cpp + MediaQueryExp.h + MediaQuery.h + Pair.h + quirks.css + Rect.h + Rect.idl + RGBColor.cpp + RGBColor.h + RGBColor.idl + ShadowValue.cpp + ShadowValue.h + StyleBase.cpp + StyleBase.h + StyleList.cpp + StyleList.h + StyleSheet.cpp + StyleSheet.h + StyleSheet.idl + StyleSheetList.cpp + StyleSheetList.h + StyleSheetList.idl + svg.css + SVGCSSComputedStyleDeclaration.cpp + SVGCSSParser.cpp + SVGCSSPropertyNames.in + SVGCSSStyleSelector.cpp + SVGCSSValueKeywords.in + themeChromiumLinux.css + themeWin.css + themeWinQuirks.css + tokenizer.flex + view-source.css + WCSSPropertyNames.in + WCSSValueKeywords.in + WebKitCSSKeyframeRule.cpp + WebKitCSSKeyframeRule.h + WebKitCSSKeyframeRule.idl + WebKitCSSKeyframesRule.cpp + WebKitCSSKeyframesRule.h + WebKitCSSKeyframesRule.idl + WebKitCSSMatrix.cpp + WebKitCSSMatrix.h + WebKitCSSMatrix.idl + WebKitCSSTransformValue.cpp + WebKitCSSTransformValue.h + WebKitCSSTransformValue.idl + wml.css +2 DerivedSources.cpp + dom/ +0 ActiveDOMObject.cpp + ActiveDOMObject.h + Attr.cpp + Attr.h + Attribute.cpp + Attribute.h + Attr.idl + BeforeLoadEvent.h + BeforeLoadEvent.idl + BeforeTextInsertedEvent.cpp + BeforeTextInsertedEvent.h + BeforeUnloadEvent.cpp + BeforeUnloadEvent.h + CDATASection.cpp + CDATASection.h + CDATASection.idl + CharacterData.cpp + CharacterData.h + CharacterData.idl + CheckedRadioButtons.cpp + CheckedRadioButtons.h + ChildNodeList.cpp + ChildNodeList.h + ClassNames.cpp + ClassNames.h + ClassNodeList.cpp + ClassNodeList.h + ClientRect.cpp + ClientRect.h + ClientRect.idl + ClientRectList.cpp + ClientRectList.h + ClientRectList.idl + ClipboardAccessPolicy.h + Clipboard.cpp + ClipboardEvent.cpp + ClipboardEvent.h + Clipboard.h + Clipboard.idl + Comment.cpp + Comment.h + Comment.idl + ContainerNodeAlgorithms.h + ContainerNode.cpp + ContainerNode.h + CSSMappedAttributeDeclaration.cpp + CSSMappedAttributeDeclaration.h + default/ +0 PlatformMessagePortChannel.cpp + PlatformMessagePortChannel.h +2 Document.cpp + DocumentFragment.cpp + DocumentFragment.h + DocumentFragment.idl + Document.h + Document.idl + DocumentMarker.h + DocumentType.cpp + DocumentType.h + DocumentType.idl + DOMCoreException.h + DOMCoreException.idl + DOMImplementation.cpp + DOMImplementation.h + DOMImplementation.idl + DynamicNodeList.cpp + DynamicNodeList.h + EditingText.cpp + EditingText.h + Element.cpp + Element.h + Element.idl + ElementRareData.h + Entity.cpp + Entity.h + Entity.idl + EntityReference.cpp + EntityReference.h + EntityReference.idl + ErrorEvent.cpp + ErrorEvent.h + ErrorEvent.idl + Event.cpp + EventException.h + EventException.idl + Event.h + Event.idl + EventListener.h + EventListener.idl + EventNames.cpp + EventNames.h + EventTarget.cpp + EventTarget.h + EventTarget.idl + ExceptionBase.cpp + ExceptionBase.h + ExceptionCode.cpp + ExceptionCode.h + InputElement.cpp + InputElement.h + KeyboardEvent.cpp + KeyboardEvent.h + KeyboardEvent.idl + make_names.pl + MappedAttribute.cpp + MappedAttributeEntry.h + MappedAttribute.h + MessageChannel.cpp + MessageChannel.h + MessageChannel.idl + MessageEvent.cpp + MessageEvent.h + MessageEvent.idl + MessagePortChannel.cpp + MessagePortChannel.h + MessagePort.cpp + MessagePort.h + MessagePort.idl + MouseEvent.cpp + MouseEvent.h + MouseEvent.idl + MouseRelatedEvent.cpp + MouseRelatedEvent.h + MutationEvent.cpp + MutationEvent.h + MutationEvent.idl + NamedAttrMap.cpp + NamedAttrMap.h + NamedMappedAttrMap.cpp + NamedMappedAttrMap.h + NamedNodeMap.h + NamedNodeMap.idl + NameNodeList.cpp + NameNodeList.h + Node.cpp + NodeFilterCondition.cpp + NodeFilterCondition.h + NodeFilter.cpp + NodeFilter.h + NodeFilter.idl + Node.h + Node.idl + NodeIterator.cpp + NodeIterator.h + NodeIterator.idl + NodeList.h + NodeList.idl + NodeRareData.h + NodeRenderStyle.h + NodeWithIndex.h + Notation.cpp + Notation.h + Notation.idl + OptionElement.cpp + OptionElement.h + OptionGroupElement.cpp + OptionGroupElement.h + OverflowEvent.cpp + OverflowEvent.h + OverflowEvent.idl + PageTransitionEvent.cpp + PageTransitionEvent.h + PageTransitionEvent.idl + Position.cpp + PositionCreationFunctions.h + Position.h + PositionIterator.cpp + PositionIterator.h + ProcessingInstruction.cpp + ProcessingInstruction.h + ProcessingInstruction.idl + ProgressEvent.cpp + ProgressEvent.h + ProgressEvent.idl + QualifiedName.cpp + QualifiedName.h + RangeBoundaryPoint.h + Range.cpp + RangeException.h + RangeException.idl + Range.h + Range.idl + RegisteredEventListener.cpp + RegisteredEventListener.h + ScriptElement.cpp + ScriptElement.h + ScriptExecutionContext.cpp + ScriptExecutionContext.h + SelectElement.cpp + SelectElement.h + SelectorNodeList.cpp + SelectorNodeList.h + StaticNodeList.cpp + StaticNodeList.h + StyledElement.cpp + StyledElement.h + StyleElement.cpp + StyleElement.h + TagNodeList.cpp + TagNodeList.h + Text.cpp + TextEvent.cpp + TextEvent.h + TextEvent.idl + Text.h + Text.idl + Tokenizer.h + TransformSource.h + TransformSourceLibxslt.cpp + TransformSourceQt.cpp + Traversal.cpp + Traversal.h + TreeWalker.cpp + TreeWalker.h + TreeWalker.idl + UIEvent.cpp + UIEvent.h + UIEvent.idl + UIEventWithKeyState.cpp + UIEventWithKeyState.h + WebKitAnimationEvent.cpp + WebKitAnimationEvent.h + WebKitAnimationEvent.idl + WebKitTransitionEvent.cpp + WebKitTransitionEvent.h + WebKitTransitionEvent.idl + WheelEvent.cpp + WheelEvent.h + WheelEvent.idl + XMLTokenizer.cpp + XMLTokenizer.h + XMLTokenizerLibxml2.cpp + XMLTokenizerQt.cpp + XMLTokenizerScope.cpp + XMLTokenizerScope.h +2 editing/ +0 android/ +0 EditorAndroid.cpp +2 AppendNodeCommand.cpp + AppendNodeCommand.h + ApplyStyleCommand.cpp + ApplyStyleCommand.h + BreakBlockquoteCommand.cpp + BreakBlockquoteCommand.h + chromium/ +0 EditorChromium.cpp +2 CompositeEditCommand.cpp + CompositeEditCommand.h + CreateLinkCommand.cpp + CreateLinkCommand.h + DeleteButtonController.cpp + DeleteButtonController.h + DeleteButton.cpp + DeleteButton.h + DeleteFromTextNodeCommand.cpp + DeleteFromTextNodeCommand.h + DeleteSelectionCommand.cpp + DeleteSelectionCommand.h + EditAction.h + EditCommand.cpp + EditCommand.h + EditorCommand.cpp + Editor.cpp + EditorDeleteAction.h + Editor.h + EditorInsertAction.h + FormatBlockCommand.cpp + FormatBlockCommand.h + gtk/ +0 SelectionControllerGtk.cpp +2 htmlediting.cpp + htmlediting.h + HTMLInterchange.cpp + HTMLInterchange.h + IndentOutdentCommand.cpp + IndentOutdentCommand.h + InsertIntoTextNodeCommand.cpp + InsertIntoTextNodeCommand.h + InsertLineBreakCommand.cpp + InsertLineBreakCommand.h + InsertListCommand.cpp + InsertListCommand.h + InsertNodeBeforeCommand.cpp + InsertNodeBeforeCommand.h + InsertParagraphSeparatorCommand.cpp + InsertParagraphSeparatorCommand.h + InsertTextCommand.cpp + InsertTextCommand.h + JoinTextNodesCommand.cpp + JoinTextNodesCommand.h + markup.cpp + markup.h + MergeIdenticalElementsCommand.cpp + MergeIdenticalElementsCommand.h + ModifySelectionListLevel.cpp + ModifySelectionListLevel.h + MoveSelectionCommand.cpp + MoveSelectionCommand.h + qt/ +0 EditorQt.cpp +2 RemoveCSSPropertyCommand.cpp + RemoveCSSPropertyCommand.h + RemoveFormatCommand.cpp + RemoveFormatCommand.h + RemoveNodeCommand.cpp + RemoveNodeCommand.h + RemoveNodePreservingChildrenCommand.cpp + RemoveNodePreservingChildrenCommand.h + ReplaceNodeWithSpanCommand.cpp + ReplaceNodeWithSpanCommand.h + ReplaceSelectionCommand.cpp + ReplaceSelectionCommand.h + SelectionController.cpp + SelectionController.h + SetNodeAttributeCommand.cpp + SetNodeAttributeCommand.h + SmartReplaceCF.cpp + SmartReplace.cpp + SmartReplace.h + SmartReplaceICU.cpp + SplitElementCommand.cpp + SplitElementCommand.h + SplitTextNodeCommand.cpp + SplitTextNodeCommand.h + SplitTextNodeContainingElementCommand.cpp + SplitTextNodeContainingElementCommand.h + TextAffinity.h + TextGranularity.h + TextIterator.cpp + TextIterator.h + TypingCommand.cpp + TypingCommand.h + UnlinkCommand.cpp + UnlinkCommand.h + VisiblePosition.cpp + VisiblePosition.h + VisibleSelection.cpp + VisibleSelection.h + visible_units.cpp + visible_units.h + WrapContentsInDummySpanCommand.cpp + WrapContentsInDummySpanCommand.h +2 ForwardingHeaders/ +0 debugger/ +0 DebuggerActivation.h + DebuggerCallFrame.h + Debugger.h +2 interpreter/ +0 CallFrame.h + Interpreter.h +2 jit/ +0 JITCode.h +2 masm/ +0 X86Assembler.h +2 parser/ +0 SourceCode.h + SourceProvider.h +2 pcre/ +0 pcre.h +2 profiler/ +0 Profile.h + ProfileNode.h + Profiler.h +2 runtime/ +0 ArgList.h + ArrayPrototype.h + BooleanObject.h + CallData.h + Collector.h + Completion.h + ConstructData.h + DateInstance.h + Error.h + ExceptionHelpers.h + FunctionConstructor.h + FunctionPrototype.h + Identifier.h + InitializeThreading.h + InternalFunction.h + JSAPIValueWrapper.h + JSArray.h + JSByteArray.h + JSCell.h + JSFunction.h + JSGlobalData.h + JSGlobalObject.h + JSLock.h + JSNumberCell.h + JSObject.h + JSString.h + JSValue.h + Lookup.h + ObjectPrototype.h + Operations.h + PropertyMap.h + PropertyNameArray.h + Protect.h + PrototypeFunction.h + StringObject.h + StringObjectThatMasqueradesAsUndefined.h + StringPrototype.h + StructureChain.h + Structure.h + SymbolTable.h + UString.h +2 wrec/ +0 WREC.h +2 wtf/ +0 AlwaysInline.h + ASCIICType.h + Assertions.h + ByteArray.h + CrossThreadRefCounted.h + CurrentTime.h + DateInstanceCache.h + DateMath.h + Deque.h + DisallowCType.h + dtoa.h + FastAllocBase.h + FastMalloc.h + Forward.h + GetPtr.h + HashCountedSet.h + HashFunctions.h + HashMap.h + HashSet.h + HashTable.h + HashTraits.h + ListHashSet.h + ListRefPtr.h + Locker.h + MainThread.h + MathExtras.h + MessageQueue.h + Noncopyable.h + NotFound.h + OwnArrayPtr.h + OwnFastMallocPtr.h + OwnPtrCommon.h + OwnPtr.h + PassOwnPtr.h + PassRefPtr.h + Platform.h + PossiblyNull.h + PtrAndFlags.h + RandomNumber.h + RefCounted.h + RefCountedLeakCounter.h + RefPtr.h + RetainPtr.h + StdLibExtras.h + StringExtras.h + Threading.h + ThreadSpecific.h + TypeTraits.h + unicode/ +0 Collator.h + icu/ +0 UnicodeIcu.h +2 Unicode.h + UTF8.h +2 UnusedParam.h + Vector.h + VectorTraits.h + VMTags.h +3 generated/ +0 ArrayPrototype.lut.h + chartables.c + ColorData.c + CSSGrammar.cpp + CSSGrammar.h + CSSPropertyNames.cpp + CSSPropertyNames.h + CSSValueKeywords.c + CSSValueKeywords.h + DatePrototype.lut.h + DocTypeStrings.cpp + Grammar.cpp + Grammar.h + HTMLElementFactory.cpp + HTMLElementFactory.h + HTMLEntityNames.c + HTMLNames.cpp + HTMLNames.h + JSAbstractWorker.cpp + JSAbstractWorker.h + JSAttr.cpp + JSAttr.h + JSBarInfo.cpp + JSBarInfo.h + JSBeforeLoadEvent.cpp + JSBeforeLoadEvent.h + JSCanvasArrayBuffer.cpp + JSCanvasArrayBuffer.h + JSCanvasArray.cpp + JSCanvasArray.h + JSCanvasByteArray.cpp + JSCanvasByteArray.h + JSCanvasFloatArray.cpp + JSCanvasFloatArray.h + JSCanvasGradient.cpp + JSCanvasGradient.h + JSCanvasIntArray.cpp + JSCanvasIntArray.h + JSCanvasPattern.cpp + JSCanvasPattern.h + JSCanvasRenderingContext2D.cpp + JSCanvasRenderingContext2D.h + JSCanvasRenderingContext3D.cpp + JSCanvasRenderingContext3D.h + JSCanvasRenderingContext.cpp + JSCanvasRenderingContext.h + JSCanvasShortArray.cpp + JSCanvasShortArray.h + JSCanvasUnsignedByteArray.cpp + JSCanvasUnsignedByteArray.h + JSCanvasUnsignedIntArray.cpp + JSCanvasUnsignedIntArray.h + JSCanvasUnsignedShortArray.cpp + JSCanvasUnsignedShortArray.h + JSCDATASection.cpp + JSCDATASection.h + JSCharacterData.cpp + JSCharacterData.h + JSClientRect.cpp + JSClientRect.h + JSClientRectList.cpp + JSClientRectList.h + JSClipboard.cpp + JSClipboard.h + JSComment.cpp + JSComment.h + JSConsole.cpp + JSConsole.h + JSCoordinates.cpp + JSCoordinates.h + JSCounter.cpp + JSCounter.h + JSCSSCharsetRule.cpp + JSCSSCharsetRule.h + JSCSSFontFaceRule.cpp + JSCSSFontFaceRule.h + JSCSSImportRule.cpp + JSCSSImportRule.h + JSCSSMediaRule.cpp + JSCSSMediaRule.h + JSCSSPageRule.cpp + JSCSSPageRule.h + JSCSSPrimitiveValue.cpp + JSCSSPrimitiveValue.h + JSCSSRule.cpp + JSCSSRule.h + JSCSSRuleList.cpp + JSCSSRuleList.h + JSCSSStyleDeclaration.cpp + JSCSSStyleDeclaration.h + JSCSSStyleRule.cpp + JSCSSStyleRule.h + JSCSSStyleSheet.cpp + JSCSSStyleSheet.h + JSCSSValue.cpp + JSCSSValue.h + JSCSSValueList.cpp + JSCSSValueList.h + JSCSSVariablesDeclaration.cpp + JSCSSVariablesDeclaration.h + JSCSSVariablesRule.cpp + JSCSSVariablesRule.h + JSDatabase.cpp + JSDatabase.h + JSDataGridColumn.cpp + JSDataGridColumn.h + JSDataGridColumnList.cpp + JSDataGridColumnList.h + JSDedicatedWorkerContext.cpp + JSDedicatedWorkerContext.h + JSDocument.cpp + JSDocumentFragment.cpp + JSDocumentFragment.h + JSDocument.h + JSDocumentType.cpp + JSDocumentType.h + JSDOMApplicationCache.cpp + JSDOMApplicationCache.h + JSDOMCoreException.cpp + JSDOMCoreException.h + JSDOMImplementation.cpp + JSDOMImplementation.h + JSDOMParser.cpp + JSDOMParser.h + JSDOMSelection.cpp + JSDOMSelection.h + JSDOMWindowBase.lut.h + JSDOMWindow.cpp + JSDOMWindow.h + JSElement.cpp + JSElement.h + JSEntity.cpp + JSEntity.h + JSEntityReference.cpp + JSEntityReference.h + JSErrorEvent.cpp + JSErrorEvent.h + JSEvent.cpp + JSEventException.cpp + JSEventException.h + JSEvent.h + JSEventSource.cpp + JSEventSource.h + JSFile.cpp + JSFile.h + JSFileList.cpp + JSFileList.h + JSGeolocation.cpp + JSGeolocation.h + JSGeoposition.cpp + JSGeoposition.h + JSHistory.cpp + JSHistory.h + JSHTMLAllCollection.cpp + JSHTMLAllCollection.h + JSHTMLAnchorElement.cpp + JSHTMLAnchorElement.h + JSHTMLAppletElement.cpp + JSHTMLAppletElement.h + JSHTMLAreaElement.cpp + JSHTMLAreaElement.h + JSHTMLAudioElement.cpp + JSHTMLAudioElement.h + JSHTMLBaseElement.cpp + JSHTMLBaseElement.h + JSHTMLBaseFontElement.cpp + JSHTMLBaseFontElement.h + JSHTMLBlockquoteElement.cpp + JSHTMLBlockquoteElement.h + JSHTMLBodyElement.cpp + JSHTMLBodyElement.h + JSHTMLBRElement.cpp + JSHTMLBRElement.h + JSHTMLButtonElement.cpp + JSHTMLButtonElement.h + JSHTMLCanvasElement.cpp + JSHTMLCanvasElement.h + JSHTMLCollection.cpp + JSHTMLCollection.h + JSHTMLDataGridCellElement.cpp + JSHTMLDataGridCellElement.h + JSHTMLDataGridColElement.cpp + JSHTMLDataGridColElement.h + JSHTMLDataGridElement.cpp + JSHTMLDataGridElement.h + JSHTMLDataGridRowElement.cpp + JSHTMLDataGridRowElement.h + JSHTMLDataListElement.cpp + JSHTMLDataListElement.h + JSHTMLDirectoryElement.cpp + JSHTMLDirectoryElement.h + JSHTMLDivElement.cpp + JSHTMLDivElement.h + JSHTMLDListElement.cpp + JSHTMLDListElement.h + JSHTMLDocument.cpp + JSHTMLDocument.h + JSHTMLElement.cpp + JSHTMLElement.h + JSHTMLElementWrapperFactory.cpp + JSHTMLElementWrapperFactory.h + JSHTMLEmbedElement.cpp + JSHTMLEmbedElement.h + JSHTMLFieldSetElement.cpp + JSHTMLFieldSetElement.h + JSHTMLFontElement.cpp + JSHTMLFontElement.h + JSHTMLFormElement.cpp + JSHTMLFormElement.h + JSHTMLFrameElement.cpp + JSHTMLFrameElement.h + JSHTMLFrameSetElement.cpp + JSHTMLFrameSetElement.h + JSHTMLHeadElement.cpp + JSHTMLHeadElement.h + JSHTMLHeadingElement.cpp + JSHTMLHeadingElement.h + JSHTMLHRElement.cpp + JSHTMLHRElement.h + JSHTMLHtmlElement.cpp + JSHTMLHtmlElement.h + JSHTMLIFrameElement.cpp + JSHTMLIFrameElement.h + JSHTMLImageElement.cpp + JSHTMLImageElement.h + JSHTMLInputElement.cpp + JSHTMLInputElement.h + JSHTMLIsIndexElement.cpp + JSHTMLIsIndexElement.h + JSHTMLLabelElement.cpp + JSHTMLLabelElement.h + JSHTMLLegendElement.cpp + JSHTMLLegendElement.h + JSHTMLLIElement.cpp + JSHTMLLIElement.h + JSHTMLLinkElement.cpp + JSHTMLLinkElement.h + JSHTMLMapElement.cpp + JSHTMLMapElement.h + JSHTMLMarqueeElement.cpp + JSHTMLMarqueeElement.h + JSHTMLMediaElement.cpp + JSHTMLMediaElement.h + JSHTMLMenuElement.cpp + JSHTMLMenuElement.h + JSHTMLMetaElement.cpp + JSHTMLMetaElement.h + JSHTMLModElement.cpp + JSHTMLModElement.h + JSHTMLObjectElement.cpp + JSHTMLObjectElement.h + JSHTMLOListElement.cpp + JSHTMLOListElement.h + JSHTMLOptGroupElement.cpp + JSHTMLOptGroupElement.h + JSHTMLOptionElement.cpp + JSHTMLOptionElement.h + JSHTMLOptionsCollection.cpp + JSHTMLOptionsCollection.h + JSHTMLParagraphElement.cpp + JSHTMLParagraphElement.h + JSHTMLParamElement.cpp + JSHTMLParamElement.h + JSHTMLPreElement.cpp + JSHTMLPreElement.h + JSHTMLQuoteElement.cpp + JSHTMLQuoteElement.h + JSHTMLScriptElement.cpp + JSHTMLScriptElement.h + JSHTMLSelectElement.cpp + JSHTMLSelectElement.h + JSHTMLSourceElement.cpp + JSHTMLSourceElement.h + JSHTMLStyleElement.cpp + JSHTMLStyleElement.h + JSHTMLTableCaptionElement.cpp + JSHTMLTableCaptionElement.h + JSHTMLTableCellElement.cpp + JSHTMLTableCellElement.h + JSHTMLTableColElement.cpp + JSHTMLTableColElement.h + JSHTMLTableElement.cpp + JSHTMLTableElement.h + JSHTMLTableRowElement.cpp + JSHTMLTableRowElement.h + JSHTMLTableSectionElement.cpp + JSHTMLTableSectionElement.h + JSHTMLTextAreaElement.cpp + JSHTMLTextAreaElement.h + JSHTMLTitleElement.cpp + JSHTMLTitleElement.h + JSHTMLUListElement.cpp + JSHTMLUListElement.h + JSHTMLVideoElement.cpp + JSHTMLVideoElement.h + JSImageData.cpp + JSImageData.h + JSInspectorBackend.cpp + JSInspectorBackend.h + JSJavaScriptCallFrame.cpp + JSJavaScriptCallFrame.h + JSKeyboardEvent.cpp + JSKeyboardEvent.h + JSLocation.cpp + JSLocation.h + JSMedia.cpp + JSMediaError.cpp + JSMediaError.h + JSMedia.h + JSMediaList.cpp + JSMediaList.h + JSMessageChannel.cpp + JSMessageChannel.h + JSMessageEvent.cpp + JSMessageEvent.h + JSMessagePort.cpp + JSMessagePort.h + JSMimeTypeArray.cpp + JSMimeTypeArray.h + JSMimeType.cpp + JSMimeType.h + JSMouseEvent.cpp + JSMouseEvent.h + JSMutationEvent.cpp + JSMutationEvent.h + JSNamedNodeMap.cpp + JSNamedNodeMap.h + JSNavigator.cpp + JSNavigator.h + JSNode.cpp + JSNodeFilter.cpp + JSNodeFilter.h + JSNode.h + JSNodeIterator.cpp + JSNodeIterator.h + JSNodeList.cpp + JSNodeList.h + JSNotation.cpp + JSNotation.h + JSONObject.lut.h + JSOverflowEvent.cpp + JSOverflowEvent.h + JSPageTransitionEvent.cpp + JSPageTransitionEvent.h + JSPluginArray.cpp + JSPluginArray.h + JSPlugin.cpp + JSPlugin.h + JSPositionError.cpp + JSPositionError.h + JSProcessingInstruction.cpp + JSProcessingInstruction.h + JSProgressEvent.cpp + JSProgressEvent.h + JSRange.cpp + JSRangeException.cpp + JSRangeException.h + JSRange.h + JSRect.cpp + JSRect.h + JSRGBColor.cpp + JSRGBColor.h + JSScreen.cpp + JSScreen.h + JSSharedWorkerContext.cpp + JSSharedWorkerContext.h + JSSharedWorker.cpp + JSSharedWorker.h + JSSQLError.cpp + JSSQLError.h + JSSQLResultSet.cpp + JSSQLResultSet.h + JSSQLResultSetRowList.cpp + JSSQLResultSetRowList.h + JSSQLTransaction.cpp + JSSQLTransaction.h + JSStorage.cpp + JSStorageEvent.cpp + JSStorageEvent.h + JSStorage.h + JSStyleSheet.cpp + JSStyleSheet.h + JSStyleSheetList.cpp + JSStyleSheetList.h + JSSVGAElement.cpp + JSSVGAElement.h + JSSVGAltGlyphElement.cpp + JSSVGAltGlyphElement.h + JSSVGAngle.cpp + JSSVGAngle.h + JSSVGAnimateColorElement.cpp + JSSVGAnimateColorElement.h + JSSVGAnimatedAngle.cpp + JSSVGAnimatedAngle.h + JSSVGAnimatedBoolean.cpp + JSSVGAnimatedBoolean.h + JSSVGAnimatedEnumeration.cpp + JSSVGAnimatedEnumeration.h + JSSVGAnimatedInteger.cpp + JSSVGAnimatedInteger.h + JSSVGAnimatedLength.cpp + JSSVGAnimatedLength.h + JSSVGAnimatedLengthList.cpp + JSSVGAnimatedLengthList.h + JSSVGAnimatedNumber.cpp + JSSVGAnimatedNumber.h + JSSVGAnimatedNumberList.cpp + JSSVGAnimatedNumberList.h + JSSVGAnimatedPreserveAspectRatio.cpp + JSSVGAnimatedPreserveAspectRatio.h + JSSVGAnimatedRect.cpp + JSSVGAnimatedRect.h + JSSVGAnimatedString.cpp + JSSVGAnimatedString.h + JSSVGAnimatedTransformList.cpp + JSSVGAnimatedTransformList.h + JSSVGAnimateElement.cpp + JSSVGAnimateElement.h + JSSVGAnimateTransformElement.cpp + JSSVGAnimateTransformElement.h + JSSVGAnimationElement.cpp + JSSVGAnimationElement.h + JSSVGCircleElement.cpp + JSSVGCircleElement.h + JSSVGClipPathElement.cpp + JSSVGClipPathElement.h + JSSVGColor.cpp + JSSVGColor.h + JSSVGComponentTransferFunctionElement.cpp + JSSVGComponentTransferFunctionElement.h + JSSVGCursorElement.cpp + JSSVGCursorElement.h + JSSVGDefsElement.cpp + JSSVGDefsElement.h + JSSVGDescElement.cpp + JSSVGDescElement.h + JSSVGDocument.cpp + JSSVGDocument.h + JSSVGElement.cpp + JSSVGElement.h + JSSVGElementInstance.cpp + JSSVGElementInstance.h + JSSVGElementInstanceList.cpp + JSSVGElementInstanceList.h + JSSVGElementWrapperFactory.cpp + JSSVGElementWrapperFactory.h + JSSVGEllipseElement.cpp + JSSVGEllipseElement.h + JSSVGException.cpp + JSSVGException.h + JSSVGFEBlendElement.cpp + JSSVGFEBlendElement.h + JSSVGFEColorMatrixElement.cpp + JSSVGFEColorMatrixElement.h + JSSVGFEComponentTransferElement.cpp + JSSVGFEComponentTransferElement.h + JSSVGFECompositeElement.cpp + JSSVGFECompositeElement.h + JSSVGFEDiffuseLightingElement.cpp + JSSVGFEDiffuseLightingElement.h + JSSVGFEDisplacementMapElement.cpp + JSSVGFEDisplacementMapElement.h + JSSVGFEDistantLightElement.cpp + JSSVGFEDistantLightElement.h + JSSVGFEFloodElement.cpp + JSSVGFEFloodElement.h + JSSVGFEFuncAElement.cpp + JSSVGFEFuncAElement.h + JSSVGFEFuncBElement.cpp + JSSVGFEFuncBElement.h + JSSVGFEFuncGElement.cpp + JSSVGFEFuncGElement.h + JSSVGFEFuncRElement.cpp + JSSVGFEFuncRElement.h + JSSVGFEGaussianBlurElement.cpp + JSSVGFEGaussianBlurElement.h + JSSVGFEImageElement.cpp + JSSVGFEImageElement.h + JSSVGFEMergeElement.cpp + JSSVGFEMergeElement.h + JSSVGFEMergeNodeElement.cpp + JSSVGFEMergeNodeElement.h + JSSVGFEMorphologyElement.cpp + JSSVGFEMorphologyElement.h + JSSVGFEOffsetElement.cpp + JSSVGFEOffsetElement.h + JSSVGFEPointLightElement.cpp + JSSVGFEPointLightElement.h + JSSVGFESpecularLightingElement.cpp + JSSVGFESpecularLightingElement.h + JSSVGFESpotLightElement.cpp + JSSVGFESpotLightElement.h + JSSVGFETileElement.cpp + JSSVGFETileElement.h + JSSVGFETurbulenceElement.cpp + JSSVGFETurbulenceElement.h + JSSVGFilterElement.cpp + JSSVGFilterElement.h + JSSVGFontElement.cpp + JSSVGFontElement.h + JSSVGFontFaceElement.cpp + JSSVGFontFaceElement.h + JSSVGFontFaceFormatElement.cpp + JSSVGFontFaceFormatElement.h + JSSVGFontFaceNameElement.cpp + JSSVGFontFaceNameElement.h + JSSVGFontFaceSrcElement.cpp + JSSVGFontFaceSrcElement.h + JSSVGFontFaceUriElement.cpp + JSSVGFontFaceUriElement.h + JSSVGForeignObjectElement.cpp + JSSVGForeignObjectElement.h + JSSVGGElement.cpp + JSSVGGElement.h + JSSVGGlyphElement.cpp + JSSVGGlyphElement.h + JSSVGGradientElement.cpp + JSSVGGradientElement.h + JSSVGHKernElement.cpp + JSSVGHKernElement.h + JSSVGImageElement.cpp + JSSVGImageElement.h + JSSVGLength.cpp + JSSVGLength.h + JSSVGLengthList.cpp + JSSVGLengthList.h + JSSVGLinearGradientElement.cpp + JSSVGLinearGradientElement.h + JSSVGLineElement.cpp + JSSVGLineElement.h + JSSVGMarkerElement.cpp + JSSVGMarkerElement.h + JSSVGMaskElement.cpp + JSSVGMaskElement.h + JSSVGMatrix.cpp + JSSVGMatrix.h + JSSVGMetadataElement.cpp + JSSVGMetadataElement.h + JSSVGMissingGlyphElement.cpp + JSSVGMissingGlyphElement.h + JSSVGNumber.cpp + JSSVGNumber.h + JSSVGNumberList.cpp + JSSVGNumberList.h + JSSVGPaint.cpp + JSSVGPaint.h + JSSVGPathElement.cpp + JSSVGPathElement.h + JSSVGPathSegArcAbs.cpp + JSSVGPathSegArcAbs.h + JSSVGPathSegArcRel.cpp + JSSVGPathSegArcRel.h + JSSVGPathSegClosePath.cpp + JSSVGPathSegClosePath.h + JSSVGPathSeg.cpp + JSSVGPathSegCurvetoCubicAbs.cpp + JSSVGPathSegCurvetoCubicAbs.h + JSSVGPathSegCurvetoCubicRel.cpp + JSSVGPathSegCurvetoCubicRel.h + JSSVGPathSegCurvetoCubicSmoothAbs.cpp + JSSVGPathSegCurvetoCubicSmoothAbs.h + JSSVGPathSegCurvetoCubicSmoothRel.cpp + JSSVGPathSegCurvetoCubicSmoothRel.h + JSSVGPathSegCurvetoQuadraticAbs.cpp + JSSVGPathSegCurvetoQuadraticAbs.h + JSSVGPathSegCurvetoQuadraticRel.cpp + JSSVGPathSegCurvetoQuadraticRel.h + JSSVGPathSegCurvetoQuadraticSmoothAbs.cpp + JSSVGPathSegCurvetoQuadraticSmoothAbs.h + JSSVGPathSegCurvetoQuadraticSmoothRel.cpp + JSSVGPathSegCurvetoQuadraticSmoothRel.h + JSSVGPathSeg.h + JSSVGPathSegLinetoAbs.cpp + JSSVGPathSegLinetoAbs.h + JSSVGPathSegLinetoHorizontalAbs.cpp + JSSVGPathSegLinetoHorizontalAbs.h + JSSVGPathSegLinetoHorizontalRel.cpp + JSSVGPathSegLinetoHorizontalRel.h + JSSVGPathSegLinetoRel.cpp + JSSVGPathSegLinetoRel.h + JSSVGPathSegLinetoVerticalAbs.cpp + JSSVGPathSegLinetoVerticalAbs.h + JSSVGPathSegLinetoVerticalRel.cpp + JSSVGPathSegLinetoVerticalRel.h + JSSVGPathSegList.cpp + JSSVGPathSegList.h + JSSVGPathSegMovetoAbs.cpp + JSSVGPathSegMovetoAbs.h + JSSVGPathSegMovetoRel.cpp + JSSVGPathSegMovetoRel.h + JSSVGPatternElement.cpp + JSSVGPatternElement.h + JSSVGPoint.cpp + JSSVGPoint.h + JSSVGPointList.cpp + JSSVGPointList.h + JSSVGPolygonElement.cpp + JSSVGPolygonElement.h + JSSVGPolylineElement.cpp + JSSVGPolylineElement.h + JSSVGPreserveAspectRatio.cpp + JSSVGPreserveAspectRatio.h + JSSVGRadialGradientElement.cpp + JSSVGRadialGradientElement.h + JSSVGRect.cpp + JSSVGRectElement.cpp + JSSVGRectElement.h + JSSVGRect.h + JSSVGRenderingIntent.cpp + JSSVGRenderingIntent.h + JSSVGScriptElement.cpp + JSSVGScriptElement.h + JSSVGSetElement.cpp + JSSVGSetElement.h + JSSVGStopElement.cpp + JSSVGStopElement.h + JSSVGStringList.cpp + JSSVGStringList.h + JSSVGStyleElement.cpp + JSSVGStyleElement.h + JSSVGSVGElement.cpp + JSSVGSVGElement.h + JSSVGSwitchElement.cpp + JSSVGSwitchElement.h + JSSVGSymbolElement.cpp + JSSVGSymbolElement.h + JSSVGTextContentElement.cpp + JSSVGTextContentElement.h + JSSVGTextElement.cpp + JSSVGTextElement.h + JSSVGTextPathElement.cpp + JSSVGTextPathElement.h + JSSVGTextPositioningElement.cpp + JSSVGTextPositioningElement.h + JSSVGTitleElement.cpp + JSSVGTitleElement.h + JSSVGTransform.cpp + JSSVGTransform.h + JSSVGTransformList.cpp + JSSVGTransformList.h + JSSVGTRefElement.cpp + JSSVGTRefElement.h + JSSVGTSpanElement.cpp + JSSVGTSpanElement.h + JSSVGUnitTypes.cpp + JSSVGUnitTypes.h + JSSVGUseElement.cpp + JSSVGUseElement.h + JSSVGViewElement.cpp + JSSVGViewElement.h + JSSVGZoomEvent.cpp + JSSVGZoomEvent.h + JSText.cpp + JSTextEvent.cpp + JSTextEvent.h + JSText.h + JSTextMetrics.cpp + JSTextMetrics.h + JSTimeRanges.cpp + JSTimeRanges.h + JSTreeWalker.cpp + JSTreeWalker.h + JSUIEvent.cpp + JSUIEvent.h + JSValidityState.cpp + JSValidityState.h + JSVoidCallback.cpp + JSVoidCallback.h + JSWebKitAnimationEvent.cpp + JSWebKitAnimationEvent.h + JSWebKitCSSKeyframeRule.cpp + JSWebKitCSSKeyframeRule.h + JSWebKitCSSKeyframesRule.cpp + JSWebKitCSSKeyframesRule.h + JSWebKitCSSMatrix.cpp + JSWebKitCSSMatrix.h + JSWebKitCSSTransformValue.cpp + JSWebKitCSSTransformValue.h + JSWebKitPoint.cpp + JSWebKitPoint.h + JSWebKitTransitionEvent.cpp + JSWebKitTransitionEvent.h + JSWebSocket.cpp + JSWebSocket.h + JSWheelEvent.cpp + JSWheelEvent.h + JSWorkerContextBase.lut.h + JSWorkerContext.cpp + JSWorkerContext.h + JSWorker.cpp + JSWorker.h + JSWorkerLocation.cpp + JSWorkerLocation.h + JSWorkerNavigator.cpp + JSWorkerNavigator.h + JSXMLHttpRequest.cpp + JSXMLHttpRequestException.cpp + JSXMLHttpRequestException.h + JSXMLHttpRequest.h + JSXMLHttpRequestProgressEvent.cpp + JSXMLHttpRequestProgressEvent.h + JSXMLHttpRequestUpload.cpp + JSXMLHttpRequestUpload.h + JSXMLSerializer.cpp + JSXMLSerializer.h + JSXPathEvaluator.cpp + JSXPathEvaluator.h + JSXPathException.cpp + JSXPathException.h + JSXPathExpression.cpp + JSXPathExpression.h + JSXPathNSResolver.cpp + JSXPathNSResolver.h + JSXPathResult.cpp + JSXPathResult.h + JSXSLTProcessor.cpp + JSXSLTProcessor.h + Lexer.lut.h + MathObject.lut.h + NumberConstructor.lut.h + RegExpConstructor.lut.h + RegExpObject.lut.h + StringPrototype.lut.h + SVGElementFactory.cpp + SVGElementFactory.h + SVGNames.cpp + SVGNames.h + tokenizer.cpp + UserAgentStyleSheetsData.cpp + UserAgentStyleSheets.h + WebKitVersion.h + XLinkNames.cpp + XLinkNames.h + XMLNames.cpp + XMLNames.h + XPathGrammar.cpp + XPathGrammar.h +2 history/ +0 BackForwardListChromium.cpp + BackForwardList.cpp + BackForwardList.h + CachedFrame.cpp + CachedFrame.h + CachedFramePlatformData.h + CachedPage.cpp + CachedPage.h + cf/ +0 HistoryPropertyList.cpp + HistoryPropertyList.h +2 HistoryItem.cpp + HistoryItem.h + PageCache.cpp + PageCache.h + qt/ +0 HistoryItemQt.cpp +3 html/ +0 canvas/ +0 CanvasActiveInfo.h + CanvasActiveInfo.idl + CanvasArrayBuffer.cpp + CanvasArrayBuffer.h + CanvasArrayBuffer.idl + CanvasArray.cpp + CanvasArray.h + CanvasArray.idl + CanvasBuffer.cpp + CanvasBuffer.h + CanvasBuffer.idl + CanvasByteArray.cpp + CanvasByteArray.h + CanvasByteArray.idl + CanvasFloatArray.cpp + CanvasFloatArray.h + CanvasFloatArray.idl + CanvasFramebuffer.cpp + CanvasFramebuffer.h + CanvasFramebuffer.idl + CanvasGradient.cpp + CanvasGradient.h + CanvasGradient.idl + CanvasIntArray.cpp + CanvasIntArray.h + CanvasIntArray.idl + CanvasNumberArray.cpp + CanvasNumberArray.h + CanvasNumberArray.idl + CanvasObject.cpp + CanvasObject.h + CanvasPattern.cpp + CanvasPattern.h + CanvasPattern.idl + CanvasPixelArray.cpp + CanvasPixelArray.h + CanvasPixelArray.idl + CanvasProgram.cpp + CanvasProgram.h + CanvasProgram.idl + CanvasRenderbuffer.cpp + CanvasRenderbuffer.h + CanvasRenderbuffer.idl + CanvasRenderingContext2D.cpp + CanvasRenderingContext2D.h + CanvasRenderingContext2D.idl + CanvasRenderingContext3D.cpp + CanvasRenderingContext3D.h + CanvasRenderingContext3D.idl + CanvasRenderingContext.cpp + CanvasRenderingContext.h + CanvasRenderingContext.idl + CanvasShader.cpp + CanvasShader.h + CanvasShader.idl + CanvasShortArray.cpp + CanvasShortArray.h + CanvasShortArray.idl + CanvasStyle.cpp + CanvasStyle.h + CanvasTexture.cpp + CanvasTexture.h + CanvasTexture.idl + CanvasUnsignedByteArray.cpp + CanvasUnsignedByteArray.h + CanvasUnsignedByteArray.idl + CanvasUnsignedIntArray.cpp + CanvasUnsignedIntArray.h + CanvasUnsignedIntArray.idl + CanvasUnsignedShortArray.cpp + CanvasUnsignedShortArray.h + CanvasUnsignedShortArray.idl +2 CollectionCache.cpp + CollectionCache.h + CollectionType.h + DataGridColumn.cpp + DataGridColumn.h + DataGridColumn.idl + DataGridColumnList.cpp + DataGridColumnList.h + DataGridColumnList.idl + DataGridDataSource.h + DocTypeStrings.gperf + DOMDataGridDataSource.cpp + DOMDataGridDataSource.h + File.cpp + File.h + File.idl + FileList.cpp + FileList.h + FileList.idl + FormDataList.cpp + FormDataList.h + HTMLAllCollection.cpp + HTMLAllCollection.h + HTMLAllCollection.idl + HTMLAnchorElement.cpp + HTMLAnchorElement.h + HTMLAnchorElement.idl + HTMLAppletElement.cpp + HTMLAppletElement.h + HTMLAppletElement.idl + HTMLAreaElement.cpp + HTMLAreaElement.h + HTMLAreaElement.idl + HTMLAttributeNames.in + HTMLAudioElement.cpp + HTMLAudioElement.h + HTMLAudioElement.idl + HTMLBaseElement.cpp + HTMLBaseElement.h + HTMLBaseElement.idl + HTMLBaseFontElement.cpp + HTMLBaseFontElement.h + HTMLBaseFontElement.idl + HTMLBlockquoteElement.cpp + HTMLBlockquoteElement.h + HTMLBlockquoteElement.idl + HTMLBodyElement.cpp + HTMLBodyElement.h + HTMLBodyElement.idl + HTMLBRElement.cpp + HTMLBRElement.h + HTMLBRElement.idl + HTMLButtonElement.cpp + HTMLButtonElement.h + HTMLButtonElement.idl + HTMLCanvasElement.cpp + HTMLCanvasElement.h + HTMLCanvasElement.idl + HTMLCollection.cpp + HTMLCollection.h + HTMLCollection.idl + HTMLDataGridCellElement.cpp + HTMLDataGridCellElement.h + HTMLDataGridCellElement.idl + HTMLDataGridColElement.cpp + HTMLDataGridColElement.h + HTMLDataGridColElement.idl + HTMLDataGridElement.cpp + HTMLDataGridElement.h + HTMLDataGridElement.idl + HTMLDataGridRowElement.cpp + HTMLDataGridRowElement.h + HTMLDataGridRowElement.idl + HTMLDataListElement.cpp + HTMLDataListElement.h + HTMLDataListElement.idl + HTMLDirectoryElement.cpp + HTMLDirectoryElement.h + HTMLDirectoryElement.idl + HTMLDivElement.cpp + HTMLDivElement.h + HTMLDivElement.idl + HTMLDListElement.cpp + HTMLDListElement.h + HTMLDListElement.idl + HTMLDocument.cpp + HTMLDocument.h + HTMLDocument.idl + HTMLElement.cpp + HTMLElement.h + HTMLElement.idl + HTMLElementsAllInOne.cpp + HTMLEmbedElement.cpp + HTMLEmbedElement.h + HTMLEmbedElement.idl + HTMLEntityNames.gperf + HTMLFieldSetElement.cpp + HTMLFieldSetElement.h + HTMLFieldSetElement.idl + HTMLFontElement.cpp + HTMLFontElement.h + HTMLFontElement.idl + HTMLFormCollection.cpp + HTMLFormCollection.h + HTMLFormControlElement.cpp + HTMLFormControlElement.h + HTMLFormElement.cpp + HTMLFormElement.h + HTMLFormElement.idl + HTMLFrameElementBase.cpp + HTMLFrameElementBase.h + HTMLFrameElement.cpp + HTMLFrameElement.h + HTMLFrameElement.idl + HTMLFrameOwnerElement.cpp + HTMLFrameOwnerElement.h + HTMLFrameSetElement.cpp + HTMLFrameSetElement.h + HTMLFrameSetElement.idl + HTMLHeadElement.cpp + HTMLHeadElement.h + HTMLHeadElement.idl + HTMLHeadingElement.cpp + HTMLHeadingElement.h + HTMLHeadingElement.idl + HTMLHRElement.cpp + HTMLHRElement.h + HTMLHRElement.idl + HTMLHtmlElement.cpp + HTMLHtmlElement.h + HTMLHtmlElement.idl + HTMLIFrameElement.cpp + HTMLIFrameElement.h + HTMLIFrameElement.idl + HTMLImageElement.cpp + HTMLImageElement.h + HTMLImageElement.idl + HTMLImageLoader.cpp + HTMLImageLoader.h + HTMLInputElement.cpp + HTMLInputElement.h + HTMLInputElement.idl + HTMLIsIndexElement.cpp + HTMLIsIndexElement.h + HTMLIsIndexElement.idl + HTMLKeygenElement.cpp + HTMLKeygenElement.h + HTMLLabelElement.cpp + HTMLLabelElement.h + HTMLLabelElement.idl + HTMLLegendElement.cpp + HTMLLegendElement.h + HTMLLegendElement.idl + HTMLLIElement.cpp + HTMLLIElement.h + HTMLLIElement.idl + HTMLLinkElement.cpp + HTMLLinkElement.h + HTMLLinkElement.idl + HTMLMapElement.cpp + HTMLMapElement.h + HTMLMapElement.idl + HTMLMarqueeElement.cpp + HTMLMarqueeElement.h + HTMLMarqueeElement.idl + HTMLMediaElement.cpp + HTMLMediaElement.h + HTMLMediaElement.idl + HTMLMenuElement.cpp + HTMLMenuElement.h + HTMLMenuElement.idl + HTMLMetaElement.cpp + HTMLMetaElement.h + HTMLMetaElement.idl + HTMLModElement.cpp + HTMLModElement.h + HTMLModElement.idl + HTMLNameCollection.cpp + HTMLNameCollection.h + HTMLNoScriptElement.cpp + HTMLNoScriptElement.h + HTMLObjectElement.cpp + HTMLObjectElement.h + HTMLObjectElement.idl + HTMLOListElement.cpp + HTMLOListElement.h + HTMLOListElement.idl + HTMLOptGroupElement.cpp + HTMLOptGroupElement.h + HTMLOptGroupElement.idl + HTMLOptionElement.cpp + HTMLOptionElement.h + HTMLOptionElement.idl + HTMLOptionsCollection.cpp + HTMLOptionsCollection.h + HTMLOptionsCollection.idl + HTMLParagraphElement.cpp + HTMLParagraphElement.h + HTMLParagraphElement.idl + HTMLParamElement.cpp + HTMLParamElement.h + HTMLParamElement.idl + HTMLParser.cpp + HTMLParserErrorCodes.cpp + HTMLParserErrorCodes.h + HTMLParser.h + HTMLParserQuirks.h + HTMLPlugInElement.cpp + HTMLPlugInElement.h + HTMLPlugInImageElement.cpp + HTMLPlugInImageElement.h + HTMLPreElement.cpp + HTMLPreElement.h + HTMLPreElement.idl + HTMLQuoteElement.cpp + HTMLQuoteElement.h + HTMLQuoteElement.idl + HTMLScriptElement.cpp + HTMLScriptElement.h + HTMLScriptElement.idl + HTMLSelectElement.cpp + HTMLSelectElement.h + HTMLSelectElement.idl + HTMLSourceElement.cpp + HTMLSourceElement.h + HTMLSourceElement.idl + HTMLStyleElement.cpp + HTMLStyleElement.h + HTMLStyleElement.idl + HTMLTableCaptionElement.cpp + HTMLTableCaptionElement.h + HTMLTableCaptionElement.idl + HTMLTableCellElement.cpp + HTMLTableCellElement.h + HTMLTableCellElement.idl + HTMLTableColElement.cpp + HTMLTableColElement.h + HTMLTableColElement.idl + HTMLTableElement.cpp + HTMLTableElement.h + HTMLTableElement.idl + HTMLTablePartElement.cpp + HTMLTablePartElement.h + HTMLTableRowElement.cpp + HTMLTableRowElement.h + HTMLTableRowElement.idl + HTMLTableRowsCollection.cpp + HTMLTableRowsCollection.h + HTMLTableSectionElement.cpp + HTMLTableSectionElement.h + HTMLTableSectionElement.idl + HTMLTagNames.in + HTMLTextAreaElement.cpp + HTMLTextAreaElement.h + HTMLTextAreaElement.idl + HTMLTitleElement.cpp + HTMLTitleElement.h + HTMLTitleElement.idl + HTMLTokenizer.cpp + HTMLTokenizer.h + HTMLUListElement.cpp + HTMLUListElement.h + HTMLUListElement.idl + HTMLVideoElement.cpp + HTMLVideoElement.h + HTMLVideoElement.idl + HTMLViewSourceDocument.cpp + HTMLViewSourceDocument.h + ImageData.cpp + ImageData.h + ImageData.idl + MediaError.h + MediaError.idl + PreloadScanner.cpp + PreloadScanner.h + TextMetrics.h + TextMetrics.idl + TimeRanges.cpp + TimeRanges.h + TimeRanges.idl + ValidityState.cpp + ValidityState.h + ValidityState.idl + VoidCallback.h + VoidCallback.idl +2 Info.plist + inspector/ +0 ConsoleMessage.cpp + ConsoleMessage.h + front-end/ +0 AbstractTimelinePanel.js + BottomUpProfileDataGridTree.js + Breakpoint.js + BreakpointsSidebarPane.js + Callback.js + CallStackSidebarPane.js + ChangesView.js + Color.js + ConsoleView.js + CookieItemsView.js + Database.js + DatabaseQueryView.js + DatabaseTableView.js + DataGrid.js + DOMAgent.js + DOMStorageDataGrid.js + DOMStorageItemsView.js + DOMStorage.js + Drawer.js + ElementsPanel.js + ElementsTreeOutline.js + EventListenersSidebarPane.js + FontView.js + Images/ +0 back.png + checker.png + clearConsoleButtonGlyph.png + closeButtons.png + consoleButtonGlyph.png + cookie.png + database.png + databaseTable.png + debuggerContinue.png + debuggerPause.png + debuggerStepInto.png + debuggerStepOut.png + debuggerStepOver.png + disclosureTriangleSmallDownBlack.png + disclosureTriangleSmallDown.png + disclosureTriangleSmallDownWhite.png + disclosureTriangleSmallRightBlack.png + disclosureTriangleSmallRightDownBlack.png + disclosureTriangleSmallRightDown.png + disclosureTriangleSmallRightDownWhite.png + disclosureTriangleSmallRight.png + disclosureTriangleSmallRightWhite.png + dockButtonGlyph.png + elementsIcon.png + enableOutlineButtonGlyph.png + enableSolidButtonGlyph.png + errorIcon.png + errorMediumIcon.png + errorRedDot.png + excludeButtonGlyph.png + focusButtonGlyph.png + forward.png + glossyHeader.png + glossyHeaderPressed.png + glossyHeaderSelected.png + glossyHeaderSelectedPressed.png + goArrow.png + graphLabelCalloutLeft.png + graphLabelCalloutRight.png + grayConnectorPoint.png + largerResourcesButtonGlyph.png + localStorage.png + nodeSearchButtonGlyph.png + paneBottomGrowActive.png + paneBottomGrow.png + paneGrowHandleLine.png + paneSettingsButtons.png + pauseOnExceptionButtonGlyph.png + percentButtonGlyph.png + profileGroupIcon.png + profileIcon.png + profilesIcon.png + profileSmallIcon.png + profilesSilhouette.png + radioDot.png + recordButtonGlyph.png + recordToggledButtonGlyph.png + reloadButtonGlyph.png + resourceCSSIcon.png + resourceDocumentIcon.png + resourceDocumentIconSmall.png + resourceJSIcon.png + resourcePlainIcon.png + resourcePlainIconSmall.png + resourcesIcon.png + resourcesSilhouette.png + resourcesSizeGraphIcon.png + resourcesTimeGraphIcon.png + scriptsIcon.png + scriptsSilhouette.png + searchSmallBlue.png + searchSmallBrightBlue.png + searchSmallGray.png + searchSmallWhite.png + segmentEnd.png + segmentHoverEnd.png + segmentHover.png + segment.png + segmentSelectedEnd.png + segmentSelected.png + sessionStorage.png + splitviewDimple.png + splitviewDividerBackground.png + statusbarBackground.png + statusbarBottomBackground.png + statusbarButtons.png + statusbarMenuButton.png + statusbarMenuButtonSelected.png + statusbarResizerHorizontal.png + statusbarResizerVertical.png + storageIcon.png + successGreenDot.png + timelineBarBlue.png + timelineBarGray.png + timelineBarGreen.png + timelineBarOrange.png + timelineBarPurple.png + timelineBarRed.png + timelineBarYellow.png + timelineCheckmarks.png + timelineDots.png + timelineHollowPillBlue.png + timelineHollowPillGray.png + timelineHollowPillGreen.png + timelineHollowPillOrange.png + timelineHollowPillPurple.png + timelineHollowPillRed.png + timelineHollowPillYellow.png + timelineIcon.png + timelinePillBlue.png + timelinePillGray.png + timelinePillGreen.png + timelinePillOrange.png + timelinePillPurple.png + timelinePillRed.png + timelinePillYellow.png + tipBalloonBottom.png + tipBalloon.png + tipIcon.png + tipIconPressed.png + toolbarItemSelected.png + treeDownTriangleBlack.png + treeDownTriangleWhite.png + treeRightTriangleBlack.png + treeRightTriangleWhite.png + treeUpTriangleBlack.png + treeUpTriangleWhite.png + undockButtonGlyph.png + userInputIcon.png + userInputPreviousIcon.png + userInputResultIcon.png + warningIcon.png + warningMediumIcon.png + warningOrangeDot.png + warningsErrors.png + whiteConnectorPoint.png +2 ImageView.js + InjectedScriptAccess.js + InjectedScript.js + InspectorControllerStub.js + inspector.css + inspector.html + inspector.js + inspectorSyntaxHighlight.css + KeyboardShortcut.js + MetricsSidebarPane.js + Object.js + ObjectPropertiesSection.js + ObjectProxy.js + PanelEnablerView.js + Panel.js + Placard.js + Popup.js + ProfileDataGridTree.js + ProfilesPanel.js + ProfileView.js + PropertiesSection.js + PropertiesSidebarPane.js + ResourceCategory.js + Resource.js + ResourcesPanel.js + ResourceView.js + ScopeChainSidebarPane.js + Script.js + ScriptsPanel.js + ScriptView.js + SidebarPane.js + SidebarTreeElement.js + SourceFrame.js + SourceView.js + StatusBarButton.js + StoragePanel.js + StylesSidebarPane.js + SummaryBar.js + TestController.js + TextPrompt.js + TimelineAgent.js + TimelinePanel.js + TopDownProfileDataGridTree.js + treeoutline.js + utilities.js + View.js + WatchExpressionsSidebarPane.js + WebKit.qrc +2 InspectorBackend.cpp + InspectorBackend.h + InspectorBackend.idl + InspectorClient.h + InspectorController.cpp + InspectorController.h + InspectorDatabaseResource.cpp + InspectorDatabaseResource.h + InspectorDOMAgent.cpp + InspectorDOMAgent.h + InspectorDOMStorageResource.cpp + InspectorDOMStorageResource.h + InspectorFrontend.cpp + InspectorFrontend.h + InspectorResource.cpp + InspectorResource.h + InspectorTimelineAgent.cpp + InspectorTimelineAgent.h + JavaScriptCallFrame.cpp + JavaScriptCallFrame.h + JavaScriptCallFrame.idl + JavaScriptDebugListener.h + JavaScriptDebugServer.cpp + JavaScriptDebugServer.h + JavaScriptProfile.cpp + JavaScriptProfile.h + JavaScriptProfileNode.cpp + JavaScriptProfileNode.h + TimelineRecordFactory.cpp + TimelineRecordFactory.h +2 LICENSE-APPLE + LICENSE-LGPL-2 +0 .1 +2 loader/ +0 appcache/ +0 ApplicationCache.cpp + ApplicationCacheGroup.cpp + ApplicationCacheGroup.h + ApplicationCache.h + ApplicationCacheHost.cpp + ApplicationCacheHost.h + ApplicationCacheResource.cpp + ApplicationCacheResource.h + ApplicationCacheStorage.cpp + ApplicationCacheStorage.h + DOMApplicationCache.cpp + DOMApplicationCache.h + DOMApplicationCache.idl + ManifestParser.cpp + ManifestParser.h +2 archive/ +0 ArchiveFactory.cpp + ArchiveFactory.h + Archive.h + ArchiveResourceCollection.cpp + ArchiveResourceCollection.h + ArchiveResource.cpp + ArchiveResource.h + cf/ +0 LegacyWebArchive.cpp + LegacyWebArchive.h + LegacyWebArchiveMac.mm +3 Cache.cpp + CachedCSSStyleSheet.cpp + CachedCSSStyleSheet.h + CachedFont.cpp + CachedFont.h + CachedImage.cpp + CachedImage.h + CachedResourceClient.h + CachedResourceClientWalker.cpp + CachedResourceClientWalker.h + CachedResource.cpp + CachedResource.h + CachedResourceHandle.cpp + CachedResourceHandle.h + CachedScript.cpp + CachedScript.h + CachedXBLDocument.cpp + CachedXBLDocument.h + CachedXSLStyleSheet.cpp + CachedXSLStyleSheet.h + Cache.h + CachePolicy.h + cf/ +0 ResourceLoaderCFNet.cpp +2 CrossOriginAccessControl.cpp + CrossOriginAccessControl.h + CrossOriginPreflightResultCache.cpp + CrossOriginPreflightResultCache.h + DocLoader.cpp + DocLoader.h + DocumentLoader.cpp + DocumentLoader.h + DocumentThreadableLoader.cpp + DocumentThreadableLoader.h + EmptyClients.h + FormState.cpp + FormState.h + FrameLoaderClient.h + FrameLoader.cpp + FrameLoader.h + FrameLoaderTypes.h + FTPDirectoryDocument.cpp + FTPDirectoryDocument.h + FTPDirectoryParser.cpp + FTPDirectoryParser.h + HistoryController.cpp + HistoryController.h + icon/ +0 IconDatabaseClient.h + IconDatabase.cpp + IconDatabase.h + IconDatabaseNone.cpp + IconFetcher.cpp + IconFetcher.h + IconLoader.cpp + IconLoader.h + IconRecord.cpp + IconRecord.h + PageURLRecord.cpp + PageURLRecord.h +2 ImageDocument.cpp + ImageDocument.h + ImageLoader.cpp + ImageLoader.h + loader.cpp + loader.h + MainResourceLoader.cpp + MainResourceLoader.h + MediaDocument.cpp + MediaDocument.h + NavigationAction.cpp + NavigationAction.h + NetscapePlugInStreamLoader.cpp + NetscapePlugInStreamLoader.h + PlaceholderDocument.cpp + PlaceholderDocument.h + PluginDocument.cpp + PluginDocument.h + PolicyCallback.cpp + PolicyCallback.h + PolicyChecker.cpp + PolicyChecker.h + ProgressTracker.cpp + ProgressTracker.h + RedirectScheduler.cpp + RedirectScheduler.h + Request.cpp + Request.h + ResourceLoader.cpp + ResourceLoader.h + ResourceLoadNotifier.cpp + ResourceLoadNotifier.h + SubresourceLoaderClient.h + SubresourceLoader.cpp + SubresourceLoader.h + SubstituteData.h + SubstituteResource.h + TextDocument.cpp + TextDocument.h + TextResourceDecoder.cpp + TextResourceDecoder.h + ThreadableLoaderClient.h + ThreadableLoaderClientWrapper.h + ThreadableLoader.cpp + ThreadableLoader.h + WorkerThreadableLoader.cpp + WorkerThreadableLoader.h +2 make-generated-sources.sh + mathml/ +0 MathMLElement.cpp + MathMLElement.h + MathMLInlineContainerElement.cpp + MathMLInlineContainerElement.h + MathMLMathElement.cpp + MathMLMathElement.h + mathtags.in +2 move-js-headers.sh + notifications/ +0 NotificationCenter.cpp + NotificationCenter.h + NotificationCenter.idl + NotificationContents.h + Notification.cpp + Notification.h + Notification.idl + NotificationPresenter.h +2 page/ +0 AbstractView.idl + android/ +0 DragControllerAndroid.cpp + EventHandlerAndroid.cpp + InspectorControllerAndroid.cpp +2 animation/ +0 AnimationBase.cpp + AnimationBase.h + AnimationController.cpp + AnimationController.h + AnimationControllerPrivate.h + CompositeAnimation.cpp + CompositeAnimation.h + ImplicitAnimation.cpp + ImplicitAnimation.h + KeyframeAnimation.cpp + KeyframeAnimation.h +2 BarInfo.cpp + BarInfo.h + BarInfo.idl + ChromeClient.h + Chrome.cpp + Chrome.h + Console.cpp + Console.h + Console.idl + ContextMenuClient.h + ContextMenuController.cpp + ContextMenuController.h + Coordinates.h + Coordinates.idl + DOMSelection.cpp + DOMSelection.h + DOMSelection.idl + DOMTimer.cpp + DOMTimer.h + DOMWindow.cpp + DOMWindow.h + DOMWindow.idl + DragActions.h + DragClient.h + DragController.cpp + DragController.h + EditorClient.h + EventHandler.cpp + EventHandler.h + EventSource.cpp + EventSource.h + EventSource.idl + FocusController.cpp + FocusController.h + FocusDirection.h + Frame.cpp + Frame.h + FrameLoadRequest.h + FrameTree.cpp + FrameTree.h + FrameView.cpp + FrameView.h + Geolocation.cpp + Geolocation.h + Geolocation.idl + Geoposition.h + Geoposition.idl + HaltablePlugin.h + History.cpp + History.h + History.idl + Location.cpp + Location.h + Location.idl + MouseEventWithHitTestResults.cpp + MouseEventWithHitTestResults.h + NavigatorBase.cpp + NavigatorBase.h + Navigator.cpp + Navigator.h + Navigator.idl + OriginAccessEntry.cpp + OriginAccessEntry.h + Page.cpp + PageGroup.cpp + PageGroup.h + PageGroupLoadDeferrer.cpp + PageGroupLoadDeferrer.h + Page.h + PluginHalterClient.h + PluginHalter.cpp + PluginHalter.h + PositionCallback.h + PositionErrorCallback.h + PositionError.h + PositionError.idl + PositionOptions.h + PrintContext.cpp + PrintContext.h + qt/ +0 DragControllerQt.cpp + EventHandlerQt.cpp + FrameQt.cpp +2 Screen.cpp + Screen.h + Screen.idl + SecurityOrigin.cpp + SecurityOrigin.h + SecurityOriginHash.h + Settings.cpp + Settings.h + UserContentURLPattern.cpp + UserContentURLPattern.h + UserScript.h + UserScriptTypes.h + UserStyleSheet.h + UserStyleSheetTypes.h + WebKitPoint.h + WebKitPoint.idl + win/ + WindowFeatures.cpp + WindowFeatures.h + win/DragControllerWin.cpp + win/EventHandlerWin.cpp + win/FrameCairoWin.cpp + win/FrameCGWin.cpp + win/FrameWin.cpp + win/FrameWin.h + win/PageWin.cpp + WorkerNavigator.cpp + WorkerNavigator.h + WorkerNavigator.idl + XSSAuditor.cpp + XSSAuditor.h +2 platform/ +0 android/ +0 ClipboardAndroid.cpp + ClipboardAndroid.h + CursorAndroid.cpp + DragDataAndroid.cpp + EventLoopAndroid.cpp + FileChooserAndroid.cpp + FileSystemAndroid.cpp + KeyboardCodes.h + KeyEventAndroid.cpp + LocalizedStringsAndroid.cpp + PopupMenuAndroid.cpp + RenderThemeAndroid.cpp + RenderThemeAndroid.h + ScreenAndroid.cpp + ScrollViewAndroid.cpp + SearchPopupMenuAndroid.cpp + SystemTimeAndroid.cpp + TemporaryLinkStubs.cpp + WidgetAndroid.cpp +2 animation/ +0 Animation.cpp + Animation.h + AnimationList.cpp + AnimationList.h + TimingFunction.h +2 Arena.cpp + Arena.h + AutodrainedPool.h + ColorData.gperf + ContentType.cpp + ContentType.h + ContextMenu.cpp + ContextMenu.h + ContextMenuItem.h + Cookie.h + CookieJar.h + CrossThreadCopier.cpp + CrossThreadCopier.h + Cursor.h + DeprecatedPtrList.h + DeprecatedPtrListImpl.cpp + DeprecatedPtrListImpl.h + DragData.cpp + DragData.h + DragImage.cpp + DragImage.h + EventLoop.h + FileChooser.cpp + FileChooser.h + FileSystem.h + FloatConversion.h + GeolocationService.cpp + GeolocationService.h + graphics/ +0 BitmapImage.cpp + BitmapImage.h + Color.cpp + Color.h + DashArray.h + filters/ +0 FEBlend.cpp + FEBlend.h + FEColorMatrix.cpp + FEColorMatrix.h + FEComponentTransfer.cpp + FEComponentTransfer.h + FEComposite.cpp + FEComposite.h + FEGaussianBlur.cpp + FEGaussianBlur.h + FilterEffect.cpp + FilterEffect.h + Filter.h + SourceAlpha.cpp + SourceAlpha.h + SourceGraphic.cpp + SourceGraphic.h +2 FloatPoint3D.cpp + FloatPoint3D.h + FloatPoint.cpp + FloatPoint.h + FloatQuad.cpp + FloatQuad.h + FloatRect.cpp + FloatRect.h + FloatSize.cpp + FloatSize.h + FontCache.cpp + FontCache.h + Font.cpp + FontData.cpp + FontData.h + FontDescription.cpp + FontDescription.h + FontFallbackList.cpp + FontFallbackList.h + FontFamily.cpp + FontFamily.h + FontFastPath.cpp + Font.h + FontRenderingMode.h + FontSelector.h + FontSmoothingMode.h + FontTraitsMask.h + GeneratedImage.cpp + GeneratedImage.h + Generator.h + GlyphBuffer.h + GlyphPageTreeNode.cpp + GlyphPageTreeNode.h + GlyphWidthMap.cpp + GlyphWidthMap.h + Gradient.cpp + Gradient.h + GraphicsContext3D.h + GraphicsContext.cpp + GraphicsContext.h + GraphicsContextPrivate.h + GraphicsLayerClient.h + GraphicsLayer.cpp + GraphicsLayer.h + GraphicsTypes.cpp + GraphicsTypes.h + Icon.h + ImageBuffer.cpp + ImageBuffer.h + Image.cpp + Image.h + ImageObserver.h + ImageSource.cpp + ImageSource.h + IntPoint.h + IntRect.cpp + IntRect.h + IntSize.h + IntSizeHash.h + MediaPlayer.cpp + MediaPlayer.h + MediaPlayerPrivate.h + opentype/ +0 OpenTypeUtilities.cpp + OpenTypeUtilities.h +2 Path.cpp + Path.h + PathTraversalState.cpp + PathTraversalState.h + Pattern.cpp + Pattern.h + Pen.cpp + Pen.h + qt/ +0 ColorQt.cpp + FloatPointQt.cpp + FloatRectQt.cpp + FontCacheQt.cpp + FontCustomPlatformData.cpp + FontCustomPlatformData.h + FontFallbackListQt.cpp + FontPlatformData.h + FontPlatformDataQt.cpp + FontQt43.cpp + FontQt.cpp + GlyphPageTreeNodeQt.cpp + GradientQt.cpp + GraphicsContextQt.cpp + IconQt.cpp + ImageBufferData.h + ImageBufferQt.cpp + ImageDecoderQt.cpp + ImageDecoderQt.h + ImageQt.cpp + IntPointQt.cpp + IntRectQt.cpp + IntSizeQt.cpp + MediaPlayerPrivatePhonon.cpp + MediaPlayerPrivatePhonon.h + PathQt.cpp + PatternQt.cpp + SimpleFontDataQt.cpp + StillImageQt.cpp + StillImageQt.h + TransformationMatrixQt.cpp +2 SegmentedFontData.cpp + SegmentedFontData.h + SimpleFontData.cpp + SimpleFontData.h + StringTruncator.cpp + StringTruncator.h + StrokeStyleApplier.h + TextRenderingMode.h + TextRun.h + transforms/ +0 IdentityTransformOperation.h + Matrix3DTransformOperation.cpp + Matrix3DTransformOperation.h + MatrixTransformOperation.cpp + MatrixTransformOperation.h + PerspectiveTransformOperation.cpp + PerspectiveTransformOperation.h + RotateTransformOperation.cpp + RotateTransformOperation.h + ScaleTransformOperation.cpp + ScaleTransformOperation.h + SkewTransformOperation.cpp + SkewTransformOperation.h + TransformationMatrix.cpp + TransformationMatrix.h + TransformOperation.h + TransformOperations.cpp + TransformOperations.h + TranslateTransformOperation.cpp + TranslateTransformOperation.h +2 UnitBezier.h + WidthIterator.cpp + WidthIterator.h +2 HostWindow.h + image-decoders/ +0 cairo/ +0 ImageDecoderCairo.cpp +2 ImageDecoder.cpp + ImageDecoder.h + qt/ +0 RGBA32BufferQt.cpp +2 wx/ +0 ImageDecoderWx.cpp +3 KeyboardCodes.h + KURL.cpp + KURLGoogle.cpp + KURLGooglePrivate.h + KURL.h + KURLHash.h + Language.h + LengthBox.h + Length.cpp + Length.h + LengthSize.h + LinkHash.cpp + LinkHash.h + LocalizedStrings.h + Logging.cpp + Logging.h + mac/ +0 AutodrainedPool.mm + BlockExceptions.h + BlockExceptions.mm + ClipboardMac.h + ClipboardMac.mm + ContextMenuItemMac.mm + ContextMenuMac.mm + CookieJar.mm + CursorMac.mm + DragDataMac.mm + DragImageMac.mm + EventLoopMac.mm + FileChooserMac.mm + FileSystemMac.mm + FoundationExtras.h + GeolocationServiceMac.h + GeolocationServiceMac.mm + KeyEventMac.mm + KURLMac.mm + Language.mm + LocalCurrentGraphicsContext.h + LocalCurrentGraphicsContext.mm + LocalizedStringsMac.mm + LoggingMac.mm + MIMETypeRegistryMac.mm + PasteboardHelper.h + PasteboardMac.mm + PlatformMouseEventMac.mm + PlatformScreenMac.mm + PopupMenuMac.mm + PurgeableBufferMac.cpp + RuntimeApplicationChecks.h + RuntimeApplicationChecks.mm + SchedulePairMac.mm + ScrollbarThemeMac.h + ScrollbarThemeMac.mm + ScrollViewMac.mm + SearchPopupMenuMac.mm + SharedBufferMac.mm + SharedTimerMac.mm + SoftLinking.h + SoundMac.mm + SSLKeyGeneratorMac.mm + SuddenTermination.mm + SystemTimeMac.cpp + ThemeMac.h + ThemeMac.mm + ThreadCheck.mm + WebCoreKeyGenerator.h + WebCoreKeyGenerator.m + WebCoreNSStringExtras.h + WebCoreNSStringExtras.mm + WebCoreObjCExtras.h + WebCoreObjCExtras.mm + WebCoreSystemInterface.h + WebCoreSystemInterface.mm + WebCoreView.h + WebCoreView.m + WebFontCache.h + WebFontCache.mm + WheelEventMac.mm + WidgetMac.mm +2 MIMETypeRegistry.cpp + MIMETypeRegistry.h + mock/ +0 GeolocationServiceMock.cpp + GeolocationServiceMock.h +2 network/ +0 AuthenticationChallengeBase.cpp + AuthenticationChallengeBase.h + Credential.cpp + Credential.h + CredentialStorage.cpp + CredentialStorage.h + DNS.h + FormDataBuilder.cpp + FormDataBuilder.h + FormData.cpp + FormData.h + HTTPHeaderMap.cpp + HTTPHeaderMap.h + HTTPParsers.cpp + HTTPParsers.h + NetworkStateNotifier.cpp + NetworkStateNotifier.h + ProtectionSpace.cpp + ProtectionSpace.h + ProtectionSpaceHash.h + qt/ +0 AuthenticationChallenge.h + DnsPrefetchHelper.cpp + DnsPrefetchHelper.h + QNetworkReplyHandler.cpp + QNetworkReplyHandler.h + ResourceError.h + ResourceHandleQt.cpp + ResourceRequest.h + ResourceRequestQt.cpp + ResourceResponse.h + SocketStreamError.h + SocketStreamHandle.h + SocketStreamHandleSoup.cpp +2 ResourceErrorBase.cpp + ResourceErrorBase.h + ResourceHandleClient.h + ResourceHandle.cpp + ResourceHandle.h + ResourceHandleInternal.h + ResourceRequestBase.cpp + ResourceRequestBase.h + ResourceResponseBase.cpp + ResourceResponseBase.h + SocketStreamErrorBase.cpp + SocketStreamErrorBase.h + SocketStreamHandleBase.cpp + SocketStreamHandleBase.h + SocketStreamHandleClient.h +2 NotImplemented.h + Pasteboard.h + PlatformKeyboardEvent.h + PlatformMenuDescription.h + PlatformMouseEvent.h + PlatformScreen.h + PlatformWheelEvent.h + PopupMenuClient.h + PopupMenu.h + PopupMenuStyle.h + posix/ +0 FileSystemPOSIX.cpp +2 PurgeableBuffer.h + qt/ +0 ClipboardQt.cpp + ClipboardQt.h + ContextMenuItemQt.cpp + ContextMenuQt.cpp + CookieJarQt.cpp + CursorQt.cpp + DragDataQt.cpp + DragImageQt.cpp + EventLoopQt.cpp + FileChooserQt.cpp + FileSystemQt.cpp + KURLQt.cpp + Localizations.cpp + LoggingQt.cpp + MIMETypeRegistryQt.cpp + PasteboardQt.cpp + PlatformKeyboardEventQt.cpp + PlatformMouseEventQt.cpp + PlatformScreenQt.cpp + PopupMenuQt.cpp + QWebPageClient.h + QWebPopup.cpp + QWebPopup.h + RenderThemeQt.cpp + RenderThemeQt.h + ScreenQt.cpp + ScrollbarQt.cpp + ScrollbarThemeQt.cpp + ScrollbarThemeQt.h + ScrollViewQt.cpp + SearchPopupMenuQt.cpp + SharedBufferQt.cpp + SharedTimerQt.cpp + SoundQt.cpp + TemporaryLinkStubs.cpp + WheelEventQt.cpp + WidgetQt.cpp +2 RunLoopTimer.h + ScrollbarClient.h + Scrollbar.cpp + Scrollbar.h + ScrollbarThemeComposite.cpp + ScrollbarThemeComposite.h + ScrollbarTheme.h + ScrollTypes.h + ScrollView.cpp + ScrollView.h + SearchPopupMenu.h + SharedBuffer.cpp + SharedBuffer.h + SharedTimer.h + Sound.h + sql/ +0 SQLiteAuthorizer.cpp + SQLiteDatabase.cpp + SQLiteDatabase.h + SQLiteFileSystem.cpp + SQLiteFileSystem.h + SQLiteStatement.cpp + SQLiteStatement.h + SQLiteTransaction.cpp + SQLiteTransaction.h + SQLValue.cpp + SQLValue.h +2 SSLKeyGenerator.h + StaticConstructors.h + SuddenTermination.h + SystemTime.h + text/ +0 android/ +0 TextBreakIteratorInternalICU.cpp +2 AtomicString.cpp + AtomicString.h + AtomicStringHash.h + AtomicStringImpl.h + Base64.cpp + Base64.h + BidiContext.cpp + BidiContext.h + BidiResolver.h + cf/ +0 StringCF.cpp + StringImplCF.cpp +2 CharacterNames.h + CString.cpp + CString.h + mac/ +0 character-sets.txt + CharsetData.h + mac-encodings.txt + make-charset-table.pl + ShapeArabic.c + ShapeArabic.h + StringImplMac.mm + StringMac.mm + TextBoundaries.mm + TextBreakIteratorInternalICUMac.mm + TextCodecMac.cpp + TextCodecMac.h +2 ParserUtilities.h + PlatformString.h + qt/ +0 StringQt.cpp + TextBoundaries.cpp + TextBreakIteratorQt.cpp + TextCodecQt.cpp + TextCodecQt.h +2 RegularExpression.cpp + RegularExpression.h + SegmentedString.cpp + SegmentedString.h + StringBuffer.h + StringBuilder.cpp + StringBuilder.h + String.cpp + StringHash.h + StringImpl.cpp + StringImpl.h + TextBoundaries.h + TextBoundariesICU.cpp + TextBreakIterator.h + TextBreakIteratorICU.cpp + TextBreakIteratorInternalICU.h + TextCodec.cpp + TextCodec.h + TextCodecICU.cpp + TextCodecICU.h + TextCodecLatin1.cpp + TextCodecLatin1.h + TextCodecUserDefined.cpp + TextCodecUserDefined.h + TextCodecUTF16.cpp + TextCodecUTF16.h + TextDirection.h + TextEncoding.cpp + TextEncodingDetector.h + TextEncodingDetectorICU.cpp + TextEncodingDetectorNone.cpp + TextEncoding.h + TextEncodingRegistry.cpp + TextEncodingRegistry.h + TextStream.cpp + TextStream.h + UnicodeRange.cpp + UnicodeRange.h + win/ +0 TextBreakIteratorInternalICUWin.cpp +3 Theme.cpp + Theme.h + ThemeTypes.h + ThreadCheck.h + ThreadGlobalData.cpp + ThreadGlobalData.h + ThreadTimers.cpp + ThreadTimers.h + Timer.cpp + Timer.h + TreeShared.h + Widget.cpp + Widget.h + win/ +0 BitmapInfo.cpp + BitmapInfo.h + SystemTimeWin.cpp +3 plugins/ +0 mac/ +0 PluginDataMac.mm + PluginPackageMac.cpp + PluginViewMac.cpp +2 MimeTypeArray.cpp + MimeTypeArray.h + MimeTypeArray.idl + MimeType.cpp + MimeType.h + MimeType.idl + npapi.cpp + npfunctions.h + PluginArray.cpp + PluginArray.h + PluginArray.idl + Plugin.cpp + PluginDatabaseClient.h + PluginDatabase.cpp + PluginDatabase.h + PluginData.cpp + PluginData.h + PluginDataNone.cpp + PluginDebug.cpp + PluginDebug.h + Plugin.h + Plugin.idl + PluginInfoStore.cpp + PluginInfoStore.h + PluginMainThreadScheduler.cpp + PluginMainThreadScheduler.h + PluginPackage.cpp + PluginPackage.h + PluginPackageNone.cpp + PluginQuirkSet.h + PluginStream.cpp + PluginStream.h + PluginView.cpp + PluginView.h + PluginViewNone.cpp + qt/ +0 PluginContainerQt.cpp + PluginContainerQt.h + PluginDataQt.cpp + PluginPackageQt.cpp + PluginViewQt.cpp +2 symbian/ +0 npinterface.h + PluginContainerSymbian.cpp + PluginContainerSymbian.h + PluginDatabaseSymbian.cpp + PluginPackageSymbian.cpp + PluginViewSymbian.cpp +2 win/ +0 PaintHooks.asm + PluginDatabaseWin.cpp + PluginDataWin.cpp + PluginMessageThrottlerWin.cpp + PluginMessageThrottlerWin.h + PluginPackageWin.cpp + PluginViewWin.cpp +3 rendering/ +0 AutoTableLayout.cpp + AutoTableLayout.h + break_lines.cpp + break_lines.h + CounterNode.cpp + CounterNode.h + EllipsisBox.cpp + EllipsisBox.h + FixedTableLayout.cpp + FixedTableLayout.h + GapRects.h + HitTestRequest.h + HitTestResult.cpp + HitTestResult.h + InlineBox.cpp + InlineBox.h + InlineFlowBox.cpp + InlineFlowBox.h + InlineRunBox.h + InlineTextBox.cpp + InlineTextBox.h + LayoutState.cpp + LayoutState.h + MediaControlElements.cpp + MediaControlElements.h + OverlapTestRequestClient.h + PointerEventsHitRules.cpp + PointerEventsHitRules.h + RenderApplet.cpp + RenderApplet.h + RenderArena.cpp + RenderArena.h + RenderBlock.cpp + RenderBlock.h + RenderBlockLineLayout.cpp + RenderBox.cpp + RenderBox.h + RenderBoxModelObject.cpp + RenderBoxModelObject.h + RenderBR.cpp + RenderBR.h + RenderButton.cpp + RenderButton.h + RenderCounter.cpp + RenderCounter.h + RenderDataGrid.cpp + RenderDataGrid.h + RenderFieldset.cpp + RenderFieldset.h + RenderFileUploadControl.cpp + RenderFileUploadControl.h + RenderFlexibleBox.cpp + RenderFlexibleBox.h + RenderForeignObject.cpp + RenderForeignObject.h + RenderFrame.cpp + RenderFrame.h + RenderFrameSet.cpp + RenderFrameSet.h + RenderHTMLCanvas.cpp + RenderHTMLCanvas.h + RenderImage.cpp + RenderImageGeneratedContent.cpp + RenderImageGeneratedContent.h + RenderImage.h + RenderInline.cpp + RenderInline.h + RenderLayerBacking.cpp + RenderLayerBacking.h + RenderLayerCompositor.cpp + RenderLayerCompositor.h + RenderLayer.cpp + RenderLayer.h + RenderLineBoxList.cpp + RenderLineBoxList.h + RenderListBox.cpp + RenderListBox.h + RenderListItem.cpp + RenderListItem.h + RenderListMarker.cpp + RenderListMarker.h + RenderMarquee.cpp + RenderMarquee.h + RenderMediaControlsChromium.cpp + RenderMediaControlsChromium.h + RenderMediaControls.cpp + RenderMediaControls.h + RenderMedia.cpp + RenderMedia.h + RenderMenuList.cpp + RenderMenuList.h + RenderObjectChildList.cpp + RenderObjectChildList.h + RenderObject.cpp + RenderObject.h + RenderOverflow.h + RenderPart.cpp + RenderPart.h + RenderPartObject.cpp + RenderPartObject.h + RenderPath.cpp + RenderPath.h + RenderReplaced.cpp + RenderReplaced.h + RenderReplica.cpp + RenderReplica.h + RenderScrollbar.cpp + RenderScrollbar.h + RenderScrollbarPart.cpp + RenderScrollbarPart.h + RenderScrollbarTheme.cpp + RenderScrollbarTheme.h + RenderSelectionInfo.h + RenderSlider.cpp + RenderSlider.h + RenderSVGBlock.cpp + RenderSVGBlock.h + RenderSVGContainer.cpp + RenderSVGContainer.h + RenderSVGGradientStop.cpp + RenderSVGGradientStop.h + RenderSVGHiddenContainer.cpp + RenderSVGHiddenContainer.h + RenderSVGImage.cpp + RenderSVGImage.h + RenderSVGInline.cpp + RenderSVGInline.h + RenderSVGInlineText.cpp + RenderSVGInlineText.h + RenderSVGModelObject.cpp + RenderSVGModelObject.h + RenderSVGRoot.cpp + RenderSVGRoot.h + RenderSVGText.cpp + RenderSVGText.h + RenderSVGTextPath.cpp + RenderSVGTextPath.h + RenderSVGTransformableContainer.cpp + RenderSVGTransformableContainer.h + RenderSVGTSpan.cpp + RenderSVGTSpan.h + RenderSVGViewportContainer.cpp + RenderSVGViewportContainer.h + RenderTableCell.cpp + RenderTableCell.h + RenderTableCol.cpp + RenderTableCol.h + RenderTable.cpp + RenderTable.h + RenderTableRow.cpp + RenderTableRow.h + RenderTableSection.cpp + RenderTableSection.h + RenderTextControl.cpp + RenderTextControl.h + RenderTextControlMultiLine.cpp + RenderTextControlMultiLine.h + RenderTextControlSingleLine.cpp + RenderTextControlSingleLine.h + RenderText.cpp + RenderTextFragment.cpp + RenderTextFragment.h + RenderText.h + RenderThemeChromiumLinux.cpp + RenderThemeChromiumLinux.h + RenderThemeChromiumMac.h + RenderThemeChromiumMac.mm + RenderThemeChromiumSkia.cpp + RenderThemeChromiumSkia.h + RenderThemeChromiumWin.cpp + RenderThemeChromiumWin.h + RenderTheme.cpp + RenderTheme.h + RenderThemeMac.h + RenderThemeSafari.cpp + RenderThemeSafari.h + RenderThemeWince.cpp + RenderThemeWince.h + RenderThemeWin.cpp + RenderThemeWin.h + RenderTreeAsText.cpp + RenderTreeAsText.h + RenderVideo.cpp + RenderVideo.h + RenderView.cpp + RenderView.h + RenderWidget.cpp + RenderWidget.h + RenderWidgetProtector.h + RenderWordBreak.cpp + RenderWordBreak.h + RootInlineBox.cpp + RootInlineBox.h + ScrollBehavior.cpp + ScrollBehavior.h + style/ +0 BindingURI.cpp + BindingURI.h + BorderData.h + BorderValue.h + CollapsedBorderValue.h + ContentData.cpp + ContentData.h + CounterContent.h + CounterDirectives.cpp + CounterDirectives.h + CursorData.h + CursorList.h + DataRef.h + FillLayer.cpp + FillLayer.h + KeyframeList.cpp + KeyframeList.h + NinePieceImage.cpp + NinePieceImage.h + OutlineValue.h + RenderStyleConstants.h + RenderStyle.cpp + RenderStyle.h + ShadowData.cpp + ShadowData.h + StyleBackgroundData.cpp + StyleBackgroundData.h + StyleBoxData.cpp + StyleBoxData.h + StyleCachedImage.cpp + StyleCachedImage.h + StyleDashboardRegion.h + StyleFlexibleBoxData.cpp + StyleFlexibleBoxData.h + StyleGeneratedImage.cpp + StyleGeneratedImage.h + StyleImage.h + StyleInheritedData.cpp + StyleInheritedData.h + StyleMarqueeData.cpp + StyleMarqueeData.h + StyleMultiColData.cpp + StyleMultiColData.h + StyleRareInheritedData.cpp + StyleRareInheritedData.h + StyleRareNonInheritedData.cpp + StyleRareNonInheritedData.h + StyleReflection.h + StyleSurroundData.cpp + StyleSurroundData.h + StyleTransformData.cpp + StyleTransformData.h + StyleVisualData.cpp + StyleVisualData.h + SVGRenderStyle.cpp + SVGRenderStyleDefs.cpp + SVGRenderStyleDefs.h + SVGRenderStyle.h +2 SVGCharacterLayoutInfo.cpp + SVGCharacterLayoutInfo.h + SVGInlineFlowBox.cpp + SVGInlineFlowBox.h + SVGInlineTextBox.cpp + SVGInlineTextBox.h + SVGRenderSupport.cpp + SVGRenderSupport.h + SVGRenderTreeAsText.cpp + SVGRenderTreeAsText.h + SVGRootInlineBox.cpp + SVGRootInlineBox.h + TableLayout.h + TextControlInnerElements.cpp + TextControlInnerElements.h + TransformState.cpp + TransformState.h +2 Resources/ +0 aliasCursor.png + cellCursor.png + contextMenuCursor.png + copyCursor.png + crossHairCursor.png + deleteButton.png + deleteButtonPressed.png + deleteButtonPressed.tiff + deleteButton.tiff + eastResizeCursor.png + eastWestResizeCursor.png + helpCursor.png + linkCursor.png + missingImage.png + missingImage.tiff + moveCursor.png + noDropCursor.png + noneCursor.png + northEastResizeCursor.png + northEastSouthWestResizeCursor.png + northResizeCursor.png + northSouthResizeCursor.png + northWestResizeCursor.png + northWestSouthEastResizeCursor.png + notAllowedCursor.png + nullPlugin.png + panIcon.png + progressCursor.png + southEastResizeCursor.png + southResizeCursor.png + southWestResizeCursor.png + textAreaResizeCorner.png + textAreaResizeCorner.tiff + urlIcon.png + verticalTextCursor.png + waitCursor.png + westResizeCursor.png + zoomInCursor.png + zoomOutCursor.png +2 storage/ +0 ChangeVersionWrapper.cpp + ChangeVersionWrapper.h + DatabaseAuthorizer.cpp + DatabaseAuthorizer.h + Database.cpp + DatabaseDetails.h + Database.h + Database.idl + DatabaseTask.cpp + DatabaseTask.h + DatabaseThread.cpp + DatabaseThread.h + DatabaseTrackerClient.h + DatabaseTracker.cpp + DatabaseTracker.h + LocalStorageTask.cpp + LocalStorageTask.h + LocalStorageThread.cpp + LocalStorageThread.h + OriginQuotaManager.cpp + OriginQuotaManager.h + OriginUsageRecord.cpp + OriginUsageRecord.h + SQLError.h + SQLError.idl + SQLResultSet.cpp + SQLResultSet.h + SQLResultSet.idl + SQLResultSetRowList.cpp + SQLResultSetRowList.h + SQLResultSetRowList.idl + SQLStatementCallback.h + SQLStatement.cpp + SQLStatementErrorCallback.h + SQLStatement.h + SQLTransactionCallback.h + SQLTransactionClient.cpp + SQLTransactionClient.h + SQLTransactionCoordinator.cpp + SQLTransactionCoordinator.h + SQLTransaction.cpp + SQLTransactionErrorCallback.h + SQLTransaction.h + SQLTransaction.idl + StorageArea.h + StorageAreaImpl.cpp + StorageAreaImpl.h + StorageAreaSync.cpp + StorageAreaSync.h + Storage.cpp + StorageEvent.cpp + StorageEventDispatcher.cpp + StorageEventDispatcher.h + StorageEvent.h + StorageEvent.idl + Storage.h + Storage.idl + StorageMap.cpp + StorageMap.h + StorageNamespace.cpp + StorageNamespace.h + StorageNamespaceImpl.cpp + StorageNamespaceImpl.h + StorageSyncManager.cpp + StorageSyncManager.h +2 svg/ +0 animation/ +0 SMILTimeContainer.cpp + SMILTimeContainer.h + SMILTime.cpp + SMILTime.h + SVGSMILElement.cpp + SVGSMILElement.h +2 ColorDistance.cpp + ColorDistance.h + ElementTimeControl.h + ElementTimeControl.idl + GradientAttributes.h + graphics/ +0 filters/ +0 SVGDistantLightSource.h + SVGFEConvolveMatrix.cpp + SVGFEConvolveMatrix.h + SVGFEDiffuseLighting.cpp + SVGFEDiffuseLighting.h + SVGFEDisplacementMap.cpp + SVGFEDisplacementMap.h + SVGFEFlood.cpp + SVGFEFlood.h + SVGFEImage.cpp + SVGFEImage.h + SVGFEMerge.cpp + SVGFEMerge.h + SVGFEMorphology.cpp + SVGFEMorphology.h + SVGFEOffset.cpp + SVGFEOffset.h + SVGFESpecularLighting.cpp + SVGFESpecularLighting.h + SVGFETile.cpp + SVGFETile.h + SVGFETurbulence.cpp + SVGFETurbulence.h + SVGFilterBuilder.cpp + SVGFilterBuilder.h + SVGFilter.cpp + SVGFilter.h + SVGLightSource.cpp + SVGLightSource.h + SVGPointLightSource.h + SVGSpotLightSource.h +2 SVGImage.cpp + SVGImage.h + SVGPaintServer.cpp + SVGPaintServerGradient.cpp + SVGPaintServerGradient.h + SVGPaintServer.h + SVGPaintServerLinearGradient.cpp + SVGPaintServerLinearGradient.h + SVGPaintServerPattern.cpp + SVGPaintServerPattern.h + SVGPaintServerRadialGradient.cpp + SVGPaintServerRadialGradient.h + SVGPaintServerSolid.cpp + SVGPaintServerSolid.h + SVGResourceClipper.cpp + SVGResourceClipper.h + SVGResource.cpp + SVGResourceFilter.cpp + SVGResourceFilter.h + SVGResource.h + SVGResourceListener.h + SVGResourceMarker.cpp + SVGResourceMarker.h + SVGResourceMasker.cpp + SVGResourceMasker.h +2 LinearGradientAttributes.h + PatternAttributes.h + RadialGradientAttributes.h + SVGAElement.cpp + SVGAElement.h + SVGAElement.idl + SVGAllInOne.cpp + SVGAltGlyphElement.cpp + SVGAltGlyphElement.h + SVGAltGlyphElement.idl + SVGAngle.cpp + SVGAngle.h + SVGAngle.idl + SVGAnimateColorElement.cpp + SVGAnimateColorElement.h + SVGAnimateColorElement.idl + SVGAnimatedAngle.idl + SVGAnimatedBoolean.idl + SVGAnimatedEnumeration.idl + SVGAnimatedInteger.idl + SVGAnimatedLength.idl + SVGAnimatedLengthList.idl + SVGAnimatedNumber.idl + SVGAnimatedNumberList.idl + SVGAnimatedPathData.cpp + SVGAnimatedPathData.h + SVGAnimatedPathData.idl + SVGAnimatedPoints.cpp + SVGAnimatedPoints.h + SVGAnimatedPoints.idl + SVGAnimatedPreserveAspectRatio.idl + SVGAnimatedProperty.h + SVGAnimatedRect.idl + SVGAnimatedString.idl + SVGAnimatedTemplate.h + SVGAnimatedTransformList.idl + SVGAnimateElement.cpp + SVGAnimateElement.h + SVGAnimateElement.idl + SVGAnimateMotionElement.cpp + SVGAnimateMotionElement.h + SVGAnimateTransformElement.cpp + SVGAnimateTransformElement.h + SVGAnimateTransformElement.idl + SVGAnimationElement.cpp + SVGAnimationElement.h + SVGAnimationElement.idl + svgattrs.in + SVGCircleElement.cpp + SVGCircleElement.h + SVGCircleElement.idl + SVGClipPathElement.cpp + SVGClipPathElement.h + SVGClipPathElement.idl + SVGColor.cpp + SVGColor.h + SVGColor.idl + SVGComponentTransferFunctionElement.cpp + SVGComponentTransferFunctionElement.h + SVGComponentTransferFunctionElement.idl + SVGCursorElement.cpp + SVGCursorElement.h + SVGCursorElement.idl + SVGDefsElement.cpp + SVGDefsElement.h + SVGDefsElement.idl + SVGDescElement.cpp + SVGDescElement.h + SVGDescElement.idl + SVGDocument.cpp + SVGDocumentExtensions.cpp + SVGDocumentExtensions.h + SVGDocument.h + SVGDocument.idl + SVGElement.cpp + SVGElement.h + SVGElement.idl + SVGElementInstance.cpp + SVGElementInstance.h + SVGElementInstance.idl + SVGElementInstanceList.cpp + SVGElementInstanceList.h + SVGElementInstanceList.idl + SVGEllipseElement.cpp + SVGEllipseElement.h + SVGEllipseElement.idl + SVGException.h + SVGException.idl + SVGExternalResourcesRequired.cpp + SVGExternalResourcesRequired.h + SVGExternalResourcesRequired.idl + SVGFEBlendElement.cpp + SVGFEBlendElement.h + SVGFEBlendElement.idl + SVGFEColorMatrixElement.cpp + SVGFEColorMatrixElement.h + SVGFEColorMatrixElement.idl + SVGFEComponentTransferElement.cpp + SVGFEComponentTransferElement.h + SVGFEComponentTransferElement.idl + SVGFECompositeElement.cpp + SVGFECompositeElement.h + SVGFECompositeElement.idl + SVGFEDiffuseLightingElement.cpp + SVGFEDiffuseLightingElement.h + SVGFEDiffuseLightingElement.idl + SVGFEDisplacementMapElement.cpp + SVGFEDisplacementMapElement.h + SVGFEDisplacementMapElement.idl + SVGFEDistantLightElement.cpp + SVGFEDistantLightElement.h + SVGFEDistantLightElement.idl + SVGFEFloodElement.cpp + SVGFEFloodElement.h + SVGFEFloodElement.idl + SVGFEFuncAElement.cpp + SVGFEFuncAElement.h + SVGFEFuncAElement.idl + SVGFEFuncBElement.cpp + SVGFEFuncBElement.h + SVGFEFuncBElement.idl + SVGFEFuncGElement.cpp + SVGFEFuncGElement.h + SVGFEFuncGElement.idl + SVGFEFuncRElement.cpp + SVGFEFuncRElement.h + SVGFEFuncRElement.idl + SVGFEGaussianBlurElement.cpp + SVGFEGaussianBlurElement.h + SVGFEGaussianBlurElement.idl + SVGFEImageElement.cpp + SVGFEImageElement.h + SVGFEImageElement.idl + SVGFELightElement.cpp + SVGFELightElement.h + SVGFEMergeElement.cpp + SVGFEMergeElement.h + SVGFEMergeElement.idl + SVGFEMergeNodeElement.cpp + SVGFEMergeNodeElement.h + SVGFEMergeNodeElement.idl + SVGFEMorphologyElement.cpp + SVGFEMorphologyElement.h + SVGFEMorphologyElement.idl + SVGFEOffsetElement.cpp + SVGFEOffsetElement.h + SVGFEOffsetElement.idl + SVGFEPointLightElement.cpp + SVGFEPointLightElement.h + SVGFEPointLightElement.idl + SVGFESpecularLightingElement.cpp + SVGFESpecularLightingElement.h + SVGFESpecularLightingElement.idl + SVGFESpotLightElement.cpp + SVGFESpotLightElement.h + SVGFESpotLightElement.idl + SVGFETileElement.cpp + SVGFETileElement.h + SVGFETileElement.idl + SVGFETurbulenceElement.cpp + SVGFETurbulenceElement.h + SVGFETurbulenceElement.idl + SVGFilterElement.cpp + SVGFilterElement.h + SVGFilterElement.idl + SVGFilterPrimitiveStandardAttributes.cpp + SVGFilterPrimitiveStandardAttributes.h + SVGFilterPrimitiveStandardAttributes.idl + SVGFitToViewBox.cpp + SVGFitToViewBox.h + SVGFitToViewBox.idl + SVGFont.cpp + SVGFontData.cpp + SVGFontData.h + SVGFontElement.cpp + SVGFontElement.h + SVGFontElement.idl + SVGFontFaceElement.cpp + SVGFontFaceElement.h + SVGFontFaceElement.idl + SVGFontFaceFormatElement.cpp + SVGFontFaceFormatElement.h + SVGFontFaceFormatElement.idl + SVGFontFaceNameElement.cpp + SVGFontFaceNameElement.h + SVGFontFaceNameElement.idl + SVGFontFaceSrcElement.cpp + SVGFontFaceSrcElement.h + SVGFontFaceSrcElement.idl + SVGFontFaceUriElement.cpp + SVGFontFaceUriElement.h + SVGFontFaceUriElement.idl + SVGForeignObjectElement.cpp + SVGForeignObjectElement.h + SVGForeignObjectElement.idl + SVGGElement.cpp + SVGGElement.h + SVGGElement.idl + SVGGlyphElement.cpp + SVGGlyphElement.h + SVGGlyphElement.idl + SVGGlyphMap.h + SVGGradientElement.cpp + SVGGradientElement.h + SVGGradientElement.idl + SVGHKernElement.cpp + SVGHKernElement.h + SVGHKernElement.idl + SVGImageElement.cpp + SVGImageElement.h + SVGImageElement.idl + SVGImageLoader.cpp + SVGImageLoader.h + SVGLangSpace.cpp + SVGLangSpace.h + SVGLangSpace.idl + SVGLength.cpp + SVGLength.h + SVGLength.idl + SVGLengthList.cpp + SVGLengthList.h + SVGLengthList.idl + SVGLinearGradientElement.cpp + SVGLinearGradientElement.h + SVGLinearGradientElement.idl + SVGLineElement.cpp + SVGLineElement.h + SVGLineElement.idl + SVGList.h + SVGListTraits.h + SVGLocatable.cpp + SVGLocatable.h + SVGLocatable.idl + SVGMarkerElement.cpp + SVGMarkerElement.h + SVGMarkerElement.idl + SVGMaskElement.cpp + SVGMaskElement.h + SVGMaskElement.idl + SVGMatrix.idl + SVGMetadataElement.cpp + SVGMetadataElement.h + SVGMetadataElement.idl + SVGMissingGlyphElement.cpp + SVGMissingGlyphElement.h + SVGMissingGlyphElement.idl + SVGMPathElement.cpp + SVGMPathElement.h + SVGNumber.idl + SVGNumberList.cpp + SVGNumberList.h + SVGNumberList.idl + SVGPaint.cpp + SVGPaint.h + SVGPaint.idl + SVGParserUtilities.cpp + SVGParserUtilities.h + SVGPathElement.cpp + SVGPathElement.h + SVGPathElement.idl + SVGPathSegArcAbs.idl + SVGPathSegArc.cpp + SVGPathSegArc.h + SVGPathSegArcRel.idl + SVGPathSegClosePath.cpp + SVGPathSegClosePath.h + SVGPathSegClosePath.idl + SVGPathSegCurvetoCubicAbs.idl + SVGPathSegCurvetoCubic.cpp + SVGPathSegCurvetoCubic.h + SVGPathSegCurvetoCubicRel.idl + SVGPathSegCurvetoCubicSmoothAbs.idl + SVGPathSegCurvetoCubicSmooth.cpp + SVGPathSegCurvetoCubicSmooth.h + SVGPathSegCurvetoCubicSmoothRel.idl + SVGPathSegCurvetoQuadraticAbs.idl + SVGPathSegCurvetoQuadratic.cpp + SVGPathSegCurvetoQuadratic.h + SVGPathSegCurvetoQuadraticRel.idl + SVGPathSegCurvetoQuadraticSmoothAbs.idl + SVGPathSegCurvetoQuadraticSmooth.cpp + SVGPathSegCurvetoQuadraticSmooth.h + SVGPathSegCurvetoQuadraticSmoothRel.idl + SVGPathSeg.h + SVGPathSeg.idl + SVGPathSegLinetoAbs.idl + SVGPathSegLineto.cpp + SVGPathSegLineto.h + SVGPathSegLinetoHorizontalAbs.idl + SVGPathSegLinetoHorizontal.cpp + SVGPathSegLinetoHorizontal.h + SVGPathSegLinetoHorizontalRel.idl + SVGPathSegLinetoRel.idl + SVGPathSegLinetoVerticalAbs.idl + SVGPathSegLinetoVertical.cpp + SVGPathSegLinetoVertical.h + SVGPathSegLinetoVerticalRel.idl + SVGPathSegList.cpp + SVGPathSegList.h + SVGPathSegList.idl + SVGPathSegMovetoAbs.idl + SVGPathSegMoveto.cpp + SVGPathSegMoveto.h + SVGPathSegMovetoRel.idl + SVGPatternElement.cpp + SVGPatternElement.h + SVGPatternElement.idl + SVGPoint.idl + SVGPointList.cpp + SVGPointList.h + SVGPointList.idl + SVGPolyElement.cpp + SVGPolyElement.h + SVGPolygonElement.cpp + SVGPolygonElement.h + SVGPolygonElement.idl + SVGPolylineElement.cpp + SVGPolylineElement.h + SVGPolylineElement.idl + SVGPreserveAspectRatio.cpp + SVGPreserveAspectRatio.h + SVGPreserveAspectRatio.idl + SVGRadialGradientElement.cpp + SVGRadialGradientElement.h + SVGRadialGradientElement.idl + SVGRectElement.cpp + SVGRectElement.h + SVGRectElement.idl + SVGRect.idl + SVGRenderingIntent.h + SVGRenderingIntent.idl + SVGScriptElement.cpp + SVGScriptElement.h + SVGScriptElement.idl + SVGSetElement.cpp + SVGSetElement.h + SVGSetElement.idl + SVGStopElement.cpp + SVGStopElement.h + SVGStopElement.idl + SVGStringList.cpp + SVGStringList.h + SVGStringList.idl + SVGStylable.cpp + SVGStylable.h + SVGStylable.idl + SVGStyledElement.cpp + SVGStyledElement.h + SVGStyledLocatableElement.cpp + SVGStyledLocatableElement.h + SVGStyledTransformableElement.cpp + SVGStyledTransformableElement.h + SVGStyleElement.cpp + SVGStyleElement.h + SVGStyleElement.idl + SVGSVGElement.cpp + SVGSVGElement.h + SVGSVGElement.idl + SVGSwitchElement.cpp + SVGSwitchElement.h + SVGSwitchElement.idl + SVGSymbolElement.cpp + SVGSymbolElement.h + SVGSymbolElement.idl + svgtags.in + SVGTests.cpp + SVGTests.h + SVGTests.idl + SVGTextContentElement.cpp + SVGTextContentElement.h + SVGTextContentElement.idl + SVGTextElement.cpp + SVGTextElement.h + SVGTextElement.idl + SVGTextPathElement.cpp + SVGTextPathElement.h + SVGTextPathElement.idl + SVGTextPositioningElement.cpp + SVGTextPositioningElement.h + SVGTextPositioningElement.idl + SVGTitleElement.cpp + SVGTitleElement.h + SVGTitleElement.idl + SVGTransformable.cpp + SVGTransformable.h + SVGTransformable.idl + SVGTransform.cpp + SVGTransformDistance.cpp + SVGTransformDistance.h + SVGTransform.h + SVGTransform.idl + SVGTransformList.cpp + SVGTransformList.h + SVGTransformList.idl + SVGTRefElement.cpp + SVGTRefElement.h + SVGTRefElement.idl + SVGTSpanElement.cpp + SVGTSpanElement.h + SVGTSpanElement.idl + SVGUnitTypes.h + SVGUnitTypes.idl + SVGURIReference.cpp + SVGURIReference.h + SVGURIReference.idl + SVGUseElement.cpp + SVGUseElement.h + SVGUseElement.idl + SVGViewElement.cpp + SVGViewElement.h + SVGViewElement.idl + SVGViewSpec.cpp + SVGViewSpec.h + SVGViewSpec.idl + SVGZoomAndPan.cpp + SVGZoomAndPan.h + SVGZoomAndPan.idl + SVGZoomEvent.cpp + SVGZoomEvent.h + SVGZoomEvent.idl + SynchronizablePropertyController.cpp + SynchronizablePropertyController.h + SynchronizableTypeWrapper.h + xlinkattrs.in +2 WebCore.3DRendering.exp + WebCore.DashboardSupport.exp + WebCore.gypi + WebCore.JNI.exp + WebCore.NPAPI.exp + WebCore.order + WebCorePrefix.cpp + WebCorePrefix.h + WebCore.pro + WebCore.qrc + WebCore.SVG.Animation.exp + WebCore.SVG.exp + WebCore.SVG.Filters.exp + WebCore.SVG.ForeignObject.exp + WebCore.Tiger.exp + WebCore.Video.exp + WebCore.VideoProxy.exp + websockets/ +0 WebSocketChannelClient.h + WebSocketChannel.cpp + WebSocketChannel.h + WebSocket.cpp + WebSocket.h + WebSocketHandshake.cpp + WebSocketHandshake.h + WebSocket.idl +2 wml/ +0 WMLAccessElement.cpp + WMLAccessElement.h + WMLAElement.cpp + WMLAElement.h + WMLAnchorElement.cpp + WMLAnchorElement.h + WMLAttributeNames.in + WMLBRElement.cpp + WMLBRElement.h + WMLCardElement.cpp + WMLCardElement.h + WMLDocument.cpp + WMLDocument.h + WMLDoElement.cpp + WMLDoElement.h + WMLElement.cpp + WMLElement.h + WMLErrorHandling.cpp + WMLErrorHandling.h + WMLEventHandlingElement.cpp + WMLEventHandlingElement.h + WMLFieldSetElement.cpp + WMLFieldSetElement.h + WMLFormControlElement.cpp + WMLFormControlElement.h + WMLGoElement.cpp + WMLGoElement.h + WMLImageElement.cpp + WMLImageElement.h + WMLImageLoader.cpp + WMLImageLoader.h + WMLInputElement.cpp + WMLInputElement.h + WMLInsertedLegendElement.cpp + WMLInsertedLegendElement.h + WMLIntrinsicEvent.cpp + WMLIntrinsicEvent.h + WMLIntrinsicEventHandler.cpp + WMLIntrinsicEventHandler.h + WMLMetaElement.cpp + WMLMetaElement.h + WMLNoopElement.cpp + WMLNoopElement.h + WMLOnEventElement.cpp + WMLOnEventElement.h + WMLOptGroupElement.cpp + WMLOptGroupElement.h + WMLOptionElement.cpp + WMLOptionElement.h + WMLPageState.cpp + WMLPageState.h + WMLPElement.cpp + WMLPElement.h + WMLPostfieldElement.cpp + WMLPostfieldElement.h + WMLPrevElement.cpp + WMLPrevElement.h + WMLRefreshElement.cpp + WMLRefreshElement.h + WMLSelectElement.cpp + WMLSelectElement.h + WMLSetvarElement.cpp + WMLSetvarElement.h + WMLTableElement.cpp + WMLTableElement.h + WMLTagNames.in + WMLTaskElement.cpp + WMLTaskElement.h + WMLTemplateElement.cpp + WMLTemplateElement.h + WMLTimerElement.cpp + WMLTimerElement.h + WMLVariables.cpp + WMLVariables.h +2 workers/ +0 AbstractWorker.cpp + AbstractWorker.h + AbstractWorker.idl + DedicatedWorkerContext.cpp + DedicatedWorkerContext.h + DedicatedWorkerContext.idl + DedicatedWorkerThread.cpp + DedicatedWorkerThread.h + DefaultSharedWorkerRepository.cpp + DefaultSharedWorkerRepository.h + GenericWorkerTask.h + SharedWorkerContext.cpp + SharedWorkerContext.h + SharedWorkerContext.idl + SharedWorker.cpp + SharedWorker.h + SharedWorker.idl + SharedWorkerRepository.h + SharedWorkerThread.cpp + SharedWorkerThread.h + WorkerContext.cpp + WorkerContext.h + WorkerContext.idl + WorkerContextProxy.h + Worker.cpp + Worker.h + Worker.idl + WorkerLoaderProxy.h + WorkerLocation.cpp + WorkerLocation.h + WorkerLocation.idl + WorkerMessagingProxy.cpp + WorkerMessagingProxy.h + WorkerObjectProxy.h + WorkerReportingProxy.h + WorkerRunLoop.cpp + WorkerRunLoop.h + WorkerScriptLoaderClient.h + WorkerScriptLoader.cpp + WorkerScriptLoader.h + WorkerThread.cpp + WorkerThread.h +2 xml/ +0 DOMParser.cpp + DOMParser.h + DOMParser.idl + NativeXPathNSResolver.cpp + NativeXPathNSResolver.h + xmlattrs.in + XMLHttpRequest.cpp + XMLHttpRequestException.h + XMLHttpRequestException.idl + XMLHttpRequest.h + XMLHttpRequest.idl + XMLHttpRequestProgressEvent.h + XMLHttpRequestProgressEvent.idl + XMLHttpRequestUpload.cpp + XMLHttpRequestUpload.h + XMLHttpRequestUpload.idl + XMLSerializer.cpp + XMLSerializer.h + XMLSerializer.idl + XPathEvaluator.cpp + XPathEvaluator.h + XPathEvaluator.idl + XPathException.h + XPathException.idl + XPathExpression.cpp + XPathExpression.h + XPathExpression.idl + XPathExpressionNode.cpp + XPathExpressionNode.h + XPathFunctions.cpp + XPathFunctions.h + XPathGrammar.y + XPathNamespace.cpp + XPathNamespace.h + XPathNodeSet.cpp + XPathNodeSet.h + XPathNSResolver.cpp + XPathNSResolver.h + XPathNSResolver.idl + XPathParser.cpp + XPathParser.h + XPathPath.cpp + XPathPath.h + XPathPredicate.cpp + XPathPredicate.h + XPathResult.cpp + XPathResult.h + XPathResult.idl + XPathStep.cpp + XPathStep.h + XPathUtil.cpp + XPathUtil.h + XPathValue.cpp + XPathValue.h + XPathVariableReference.cpp + XPathVariableReference.h + XSLImportRule.cpp + XSLImportRule.h + XSLStyleSheet.h + XSLStyleSheetLibxslt.cpp + XSLStyleSheetQt.cpp + XSLTExtensions.cpp + XSLTExtensions.h + XSLTProcessor.cpp + XSLTProcessor.h + XSLTProcessor.idl + XSLTProcessorLibxslt.cpp + XSLTProcessorQt.cpp + XSLTUnicodeSort.cpp + XSLTUnicodeSort.h +3 WebKit/ +0 ChangeLog + LICENSE + mac/ +0 Configurations/ +0 Version.xcconfig +2 Workers/ +0 WebWorkersPrivate.h + WebWorkersPrivate.mm +4 WebKit.pri + WebKit/qt/ +0 Api/ +0 headers.pri + qgraphicswebview.cpp + qgraphicswebview.h + qwebdatabase.cpp + qwebdatabase.h + qwebdatabase_p.h + qwebelement.cpp + qwebelement.h + qwebframe.cpp + qwebframe.h + qwebframe_p.h + qwebhistory.cpp + qwebhistory.h + qwebhistoryinterface.cpp + qwebhistoryinterface.h + qwebhistory_p.h + qwebinspector.cpp + qwebinspector.h + qwebinspector_p.h + qwebkitglobal.h + qwebkitversion.cpp + qwebkitversion.h + qwebpage.cpp + qwebpage.h + qwebpage_p.h + qwebplugindatabase.cpp + qwebplugindatabase_p.h + qwebpluginfactory.cpp + qwebpluginfactory.h + qwebsecurityorigin.cpp + qwebsecurityorigin.h + qwebsecurityorigin_p.h + qwebsettings.cpp + qwebsettings.h + qwebview.cpp + qwebview.h +2 ChangeLog + docs/ +0 docs.pri + qtwebkit.qdoc +0 conf +2 qwebview-diagram.png + webkitsnippets/ +0 qtwebkit_build_snippet.qdoc + qtwebkit_qwebinspector_snippet.cpp + qtwebkit_qwebview_snippet.cpp + simple/ +0 main.cpp + simple.pro +2 webelement/ +0 main.cpp + webelement.pro +2 webpage/ +0 main.cpp + webpage.pro +4 tests/ +0 benchmarks/ +0 loading/ +0 tst_loading.cpp + tst_loading.pro +2 painting/ +0 tst_painting.cpp + tst_painting.pro +3 qgraphicswebview/ +0 qgraphicswebview.pro + tst_qgraphicswebview.cpp +2 qwebelement/ +0 image.png + qwebelement.pro + qwebelement.qrc + style2.css + style.css + tst_qwebelement.cpp +2 qwebframe/ +0 image.png + qwebframe.pro + qwebframe.qrc + resources/ +0 image2.png +2 style.css + test1.html + test2.html + tst_qwebframe.cpp +2 qwebhistory/ +0 data/ +0 page1.html + page2.html + page3.html + page4.html + page5.html + page6.html +3 qwebhistoryinterface/ +0 qwebhistoryinterface.pro + tst_qwebhistoryinterface.cpp +2 qwebhistory/qwebhistory.pro + qwebhistory/tst_qwebhistory.cpp + qwebhistory/tst_qwebhistory.qrc + qwebpage/ +0 frametest/ +0 frame_a.html + iframe2.html + iframe3.html + iframe.html + index.html +2 qwebpage.pro + tst_qwebpage.cpp + tst_qwebpage.qrc +2 qwebplugindatabase/ +0 qwebplugindatabase.pro + tst_qwebplugindatabase.cpp +2 qwebview/ +0 data/ +0 frame_a.html + index.html +2 .gitignore + qwebview.pro + tst_qwebview.cpp + tst_qwebview.qrc +2 resources/ +0 test.swf +2 tests.pro + util.h +2 WebCoreSupport/ +0 ChromeClientQt.cpp + ChromeClientQt.h + ContextMenuClientQt.cpp + ContextMenuClientQt.h + DragClientQt.cpp + DragClientQt.h + EditCommandQt.cpp + EditCommandQt.h + EditorClientQt.cpp + EditorClientQt.h + FrameLoaderClientQt.cpp + FrameLoaderClientQt.h + InspectorClientQt.cpp + InspectorClientQt.h +2 WebKit_pch.h +2 WebKit/scripts/ +0 generate-webkitversion.pl +2 WebKit/StringsNotToBeLocalized.txt +2 wintab/ +0 pktdef.h + wintab.h +2 xorg/ +0 wacomcfg.h +2 zlib/ +0 adler32.c + algorithm.txt + ChangeLog + compress.c + configure + crc32.c + crc32.h + deflate.c + deflate.h + example.c + examples/ +0 fitblk.c + gun.c + gzappend.c + gzjoin.c + gzlog.c + gzlog.h + README.examples + zlib_how.html + zpipe.c + zran.c +2 FAQ + gzio.c + INDEX + infback.c + inffast.c + inffast.h + inffixed.h + inflate.c + inflate.h + inftrees.c + inftrees.h + Makefile +0 .in +2 make_vms.com + minigzip.c + projects/ +0 README.projects + visualc6/ +0 example.dsp + minigzip.dsp + README.txt + zlib.dsp + zlib.dsw +3 README + trees.c + trees.h + uncompr.c + win32/ +0 DLL_FAQ.txt + Makefile.bor + Makefile.emx + Makefile.gcc + Makefile.msc + VisualC.txt + zlib1.rc + zlib.def +2 zconf.h + zconf.in.h + zlib.3 + zlib.h + zutil.c + zutil.h +3 activeqt/ +0 activeqt.pro + container/ +0 container.pro + qaxbase.cpp + qaxbase.h + qaxdump.cpp + qaxobject.cpp + qaxobject.h + qaxscript.cpp + qaxscript.h + qaxscriptwrapper.cpp + qaxselect.cpp + qaxselect.h + qaxselect.ui + qaxwidget.cpp + qaxwidget.h +2 control/ +0 control.pro + qaxaggregated.h + qaxbindable.cpp + qaxbindable.h + qaxfactory.cpp + qaxfactory.h + qaxmain.cpp + qaxserverbase.cpp + qaxserver.cpp + qaxserver.def + qaxserverdll.cpp + qaxserver.ico + qaxservermain.cpp + qaxserver.rc +2 shared/ +0 qaxtypes.cpp + qaxtypes.h +3 corelib/ +0 animation/ +0 animation.pri + qabstractanimation.cpp + qabstractanimation.h + qabstractanimation_p.h + qanimationgroup.cpp + qanimationgroup.h + qanimationgroup_p.h + qparallelanimationgroup.cpp + qparallelanimationgroup.h + qparallelanimationgroup_p.h + qpauseanimation.cpp + qpauseanimation.h + qpropertyanimation.cpp + qpropertyanimation.h + qpropertyanimation_p.h + qsequentialanimationgroup.cpp + qsequentialanimationgroup.h + qsequentialanimationgroup_p.h + qvariantanimation.cpp + qvariantanimation.h + qvariantanimation_p.h +2 arch/ +0 alpha/ +0 arch.pri + qatomic_alpha.s +2 arch.pri + arm/ +0 arch.pri + qatomic_arm.cpp +2 armv6/ +0 arch.pri + qatomic_generic_armv6.cpp +2 avr32/ +0 arch.pri +2 bfin/ +0 arch.pri +2 generic/ +0 arch.pri + qatomic_generic_unix.cpp + qatomic_generic_windows.cpp +2 i386/ +0 arch.pri + qatomic_i386.s +2 ia64/ +0 arch.pri + qatomic_ia64.s +2 macosx/ +0 arch.pri + qatomic32_ppc.s +2 mips/ +0 arch.pri + qatomic_mips32.s + qatomic_mips64.s +2 parisc/ +0 arch.pri + qatomic_parisc.cpp + q_ldcw.s +2 powerpc/ +0 arch.pri + qatomic32.s + qatomic64.s +2 qatomic_alpha.h + qatomic_arch.h + qatomic_arm.h + qatomic_armv6.h + qatomic_avr32.h + qatomic_bfin.h + qatomic_bootstrap.h + qatomic_generic.h + qatomic_i386.h + qatomic_ia64.h + qatomic_macosx.h + qatomic_mips.h + qatomic_parisc.h + qatomic_powerpc.h + qatomic_s390.h + qatomic_sh4a.h + qatomic_sh.h + qatomic_sparc.h + qatomic_symbian.h + qatomic_vxworks.h + qatomic_windowsce.h + qatomic_windows.h + qatomic_x86_64.h + s390/ +0 arch.pri +2 sh/ + sh4a/ +0 arch.pri +2 sh/arch.pri + sh/qatomic_sh.cpp + sparc/ +0 arch.pri + qatomic32.s + qatomic64.s + qatomic_sparc.cpp +2 symbian/ +0 arch.pri + qatomic_symbian.cpp +2 vxworks/ +0 arch.pri + qatomic_ppc.s +2 windows/ +0 arch.pri +2 x86_64/ +0 arch.pri + qatomic_sun.s +3 codecs/ +0 codecs.pri + codecs.qdoc + qfontlaocodec.cpp + qfontlaocodec_p.h + qiconvcodec.cpp + qiconvcodec_p.h + qisciicodec.cpp + qisciicodec_p.h + qlatincodec.cpp + qlatincodec_p.h + qsimplecodec.cpp + qsimplecodec_p.h + qtextcodec.cpp + qtextcodec.h + qtextcodec_p.h + qtextcodecplugin.cpp + qtextcodecplugin.h + qtsciicodec.cpp + qtsciicodec_p.h + qutfcodec.cpp + qutfcodec_p.h +2 concurrent/ +0 concurrent.pri + qfuture.cpp + qfuture.h + qfutureinterface.cpp + qfutureinterface.h + qfutureinterface_p.h + qfuturesynchronizer.cpp + qfuturesynchronizer.h + qfuturewatcher.cpp + qfuturewatcher.h + qfuturewatcher_p.h + qrunnable.cpp + qrunnable.h + qtconcurrentcompilertest.h + qtconcurrentexception.cpp + qtconcurrentexception.h + qtconcurrentfilter.cpp + qtconcurrentfilter.h + qtconcurrentfilterkernel.h + qtconcurrentfunctionwrappers.h + qtconcurrentiteratekernel.cpp + qtconcurrentiteratekernel.h + qtconcurrentmap.cpp + qtconcurrentmap.h + qtconcurrentmapkernel.h + qtconcurrentmedian.h + qtconcurrentreducekernel.h + qtconcurrentresultstore.cpp + qtconcurrentresultstore.h + qtconcurrentrunbase.h + qtconcurrentrun.cpp + qtconcurrentrun.h + qtconcurrentstoredfunctioncall.h + qtconcurrentthreadengine.cpp + qtconcurrentthreadengine.h + qthreadpool.cpp + qthreadpool.h + qthreadpool_p.h +2 corelib.pro + eval.pri + global/ +0 global.pri + qconfig-dist.h + qconfig-large.h + qconfig-medium.h + qconfig-minimal.h + qconfig-small.h + qendian.h + qendian.qdoc + qfeatures.h + qfeatures.txt + qglobal.cpp + qglobal.h + qlibraryinfo.cpp + qlibraryinfo.h + qmalloc.cpp + qnamespace.h + qnamespace.qdoc + qnumeric.cpp + qnumeric.h + qnumeric_p.h + qt_pch.h + qt_windows.h +2 io/ +0 io.pri + qabstractfileengine.cpp + qabstractfileengine.h + qabstractfileengine_p.h + qbuffer.cpp + qbuffer.h + qdatastream.cpp + qdatastream.h + qdatastream_p.h + qdebug.cpp + qdebug.h + qdir.cpp + qdir.h + qdiriterator.cpp + qdiriterator.h + qfile.cpp + qfile.h + qfileinfo.cpp + qfileinfo.h + qfileinfo_p.h + qfile_p.h + qfilesystemwatcher.cpp + qfilesystemwatcher_dnotify.cpp + qfilesystemwatcher_dnotify_p.h + qfilesystemwatcher_fsevents.cpp + qfilesystemwatcher_fsevents_p.h + qfilesystemwatcher.h + qfilesystemwatcher_inotify.cpp + qfilesystemwatcher_inotify_p.h + qfilesystemwatcher_kqueue.cpp + qfilesystemwatcher_kqueue_p.h + qfilesystemwatcher_p.h + qfilesystemwatcher_symbian.cpp + qfilesystemwatcher_symbian_p.h + qfilesystemwatcher_win.cpp + qfilesystemwatcher_win_p.h + qfsfileengine.cpp + qfsfileengine.h + qfsfileengine_iterator.cpp + qfsfileengine_iterator_p.h + qfsfileengine_iterator_unix.cpp + qfsfileengine_iterator_win.cpp + qfsfileengine_p.h + qfsfileengine_unix.cpp + qfsfileengine_win.cpp + qiodevice.cpp + qiodevice.h + qiodevice_p.h + qnoncontiguousbytedevice.cpp + qnoncontiguousbytedevice_p.h + qprocess.cpp + qprocess.h + qprocess_p.h + qprocess_symbian.cpp + qprocess_unix.cpp + qprocess_win.cpp + qresource.cpp + qresource.h + qresource_iterator.cpp + qresource_iterator_p.h + qresource_p.h + qsettings.cpp + qsettings.h + qsettings_mac.cpp + qsettings_p.h + qsettings_win.cpp + qtemporaryfile.cpp + qtemporaryfile.h + qtextstream.cpp + qtextstream.h + qurl.cpp + qurl.h + qwindowspipewriter.cpp + qwindowspipewriter_p.h +2 kernel/ +0 kernel.pri + qabstracteventdispatcher.cpp + qabstracteventdispatcher.h + qabstracteventdispatcher_p.h + qabstractitemmodel.cpp + qabstractitemmodel.h + qabstractitemmodel_p.h + qbasictimer.cpp + qbasictimer.h + qcoreapplication.cpp + qcoreapplication.h + qcoreapplication_mac.cpp + qcoreapplication_p.h + qcoreapplication_win.cpp + qcorecmdlineargs_p.h + qcoreevent.cpp + qcoreevent.h + qcoreglobaldata.cpp + qcoreglobaldata_p.h + qcore_mac.cpp + qcore_mac_p.h + qcore_symbian_p.cpp + qcore_symbian_p.h + qcore_unix.cpp + qcore_unix_p.h + qcrashhandler.cpp + qcrashhandler_p.h + qeventdispatcher_glib.cpp + qeventdispatcher_glib_p.h + qeventdispatcher_symbian.cpp + qeventdispatcher_symbian_p.h + qeventdispatcher_unix.cpp + qeventdispatcher_unix_p.h + qeventdispatcher_win.cpp + qeventdispatcher_win_p.h + qeventloop.cpp + qeventloop.h + qfunctions_p.h + qfunctions_vxworks.cpp + qfunctions_vxworks.h + qfunctions_wince.cpp + qfunctions_wince.h + qguard_p.h + qmath.cpp + qmath.h + qmetaobject.cpp + qmetaobject.h + qmetaobject_p.h + qmetatype.cpp + qmetatype.h + qmimedata.cpp + qmimedata.h + qobjectcleanuphandler.cpp + qobjectcleanuphandler.h + qobject.cpp + qobjectdefs.h + qobject.h + qobject_p.h + qpointer.cpp + qpointer.h + qsharedmemory.cpp + qsharedmemory.h + qsharedmemory_p.h + qsharedmemory_symbian.cpp + qsharedmemory_unix.cpp + qsharedmemory_win.cpp + qsignalmapper.cpp + qsignalmapper.h + qsocketnotifier.cpp + qsocketnotifier.h + qsystemsemaphore.cpp + qsystemsemaphore.h + qsystemsemaphore_p.h + qsystemsemaphore_symbian.cpp + qsystemsemaphore_unix.cpp + qsystemsemaphore_win.cpp + qtcore_eval.cpp + qtimer.cpp + qtimer.h + qtranslator.cpp + qtranslator.h + qtranslator_p.h + qvariant.cpp + qvariant.h + qvariant_p.h + qwineventnotifier_p.cpp + qwineventnotifier_p.h +2 plugin/ +0 plugin.pri + qfactoryinterface.h + qfactoryloader.cpp + qfactoryloader_p.h + qlibrary.cpp + qlibrary.h + qlibrary_p.h + qlibrary_unix.cpp + qlibrary_win.cpp + qplugin.h + qpluginloader.cpp + qpluginloader.h + qplugin.qdoc + quuid.cpp + quuid.h +2 QtCore.dynlist + statemachine/ +0 qabstractstate.cpp + qabstractstate.h + qabstractstate_p.h + qabstracttransition.cpp + qabstracttransition.h + qabstracttransition_p.h + qeventtransition.cpp + qeventtransition.h + qeventtransition_p.h + qfinalstate.cpp + qfinalstate.h + qhistorystate.cpp + qhistorystate.h + qhistorystate_p.h + qsignaleventgenerator_p.h + qsignaltransition.cpp + qsignaltransition.h + qsignaltransition_p.h + qstate.cpp + qstate.h + qstatemachine.cpp + qstatemachine.h + qstatemachine_p.h + qstate_p.h + statemachine.pri +2 thread/ +0 qatomic.cpp + qatomic.h + qbasicatomic.h + qmutex.cpp + qmutex.h + qmutex_p.h + qmutexpool.cpp + qmutexpool_p.h + qmutex_unix.cpp + qmutex_win.cpp + qorderedmutexlocker_p.h + qreadwritelock.cpp + qreadwritelock.h + qreadwritelock_p.h + qsemaphore.cpp + qsemaphore.h + qthread.cpp + qthread.h + qthread_p.h + qthreadstorage.cpp + qthreadstorage.h + qthread_unix.cpp + qthread_win.cpp + qwaitcondition.h + qwaitcondition.qdoc + qwaitcondition_unix.cpp + qwaitcondition_win.cpp + thread.pri +2 tools/ +0 qalgorithms.h + qalgorithms.qdoc + qbitarray.cpp + qbitarray.h + qbytearray.cpp + qbytearray.h + qbytearraymatcher.cpp + qbytearraymatcher.h + qbytedata_p.h + qcache.h + qcache.qdoc + qchar.cpp + qchar.h + qcontainerfwd.h + qcontiguouscache.cpp + qcontiguouscache.h + qcryptographichash.cpp + qcryptographichash.h + qdatetime.cpp + qdatetime.h + qdatetime_p.h + qeasingcurve.cpp + qeasingcurve.h + qharfbuzz.cpp + qharfbuzz_p.h + qhash.cpp + qhash.h + qiterator.h + qiterator.qdoc + qline.cpp + qline.h + qlinkedlist.cpp + qlinkedlist.h + qlist.cpp + qlist.h + qlocale.cpp + qlocale_data_p.h + qlocale.h + qlocale_p.h + qlocale_symbian.cpp + qmap.cpp + qmap.h + qmargins.cpp + qmargins.h + qpair.h + qpair.qdoc + qpodlist_p.h + qpoint.cpp + qpoint.h + qqueue.cpp + qqueue.h + qrect.cpp + qrect.h + qregexp.cpp + qregexp.h + qringbuffer_p.h + qscopedpointer.cpp + qscopedpointer.h + qscopedpointer_p.h + qset.h + qset.qdoc + qshareddata.cpp + qshareddata.h + qsharedpointer.cpp + qsharedpointer.h + qsharedpointer_impl.h + qsize.cpp + qsize.h + qstack.cpp + qstack.h + qstringbuilder.cpp + qstringbuilder.h + qstring.cpp + qstring.h + qstringlist.cpp + qstringlist.h + qstringmatcher.cpp + qstringmatcher.h + qtextboundaryfinder.cpp + qtextboundaryfinder.h + qtimeline.cpp + qtimeline.h + qtools_p.h + qunicodetables.cpp + qunicodetables_p.h + qvarlengtharray.h + qvarlengtharray.qdoc + qvector.cpp + qvector.h + qvsnprintf.cpp + tools.pri +2 xml/ +0 .gitignore + make-parser.sh + qxmlstream.cpp + qxmlstream.g + qxmlstream.h + qxmlstream_p.h + qxmlutils.cpp + qxmlutils_p.h + xml.pri +3 dbus/ +0 dbus.pro + qdbusabstractadaptor.cpp + qdbusabstractadaptor.h + qdbusabstractadaptor_p.h + qdbusabstractinterface.cpp + qdbusabstractinterface.h + qdbusabstractinterface_p.h + qdbusargument.cpp + qdbusargument.h + qdbusargument_p.h + qdbusconnection.cpp + qdbusconnection.h + qdbusconnectioninterface.cpp + qdbusconnectioninterface.h + qdbusconnection_p.h + qdbuscontext.cpp + qdbuscontext.h + qdbuscontext_p.h + qdbusdemarshaller.cpp + qdbuserror.cpp + qdbuserror.h + qdbusextratypes.cpp + qdbusextratypes.h + qdbusintegrator.cpp + qdbusintegrator_p.h + qdbusinterface.cpp + qdbusinterface.h + qdbusinterface_p.h + qdbusinternalfilters.cpp + qdbusintrospection.cpp + qdbusintrospection_p.h + qdbusmacros.h + qdbusmarshaller.cpp + qdbusmessage.cpp + qdbusmessage.h + qdbusmessage_p.h + qdbusmetaobject.cpp + qdbusmetaobject_p.h + qdbusmetatype.cpp + qdbusmetatype.h + qdbusmetatype_p.h + qdbusmisc.cpp + qdbuspendingcall.cpp + qdbuspendingcall.h + qdbuspendingcall_p.h + qdbuspendingreply.cpp + qdbuspendingreply.h + qdbusreply.cpp + qdbusreply.h + qdbusserver.cpp + qdbusserver.h + qdbusservicewatcher.cpp + qdbusservicewatcher.h + qdbus_symbols.cpp + qdbus_symbols_p.h + qdbusthreaddebug_p.h + qdbusutil.cpp + qdbusutil_p.h + qdbusxmlgenerator.cpp + qdbusxmlparser.cpp + qdbusxmlparser_p.h +2 gui/ +0 accessible/ +0 accessible.pri + qaccessible2.cpp + qaccessible2.h + qaccessiblebridge.cpp + qaccessiblebridge.h + qaccessible.cpp + qaccessible.h + qaccessible_mac_carbon.cpp + qaccessible_mac_cocoa.mm + qaccessible_mac.mm + qaccessible_mac_p.h + qaccessibleobject.cpp + qaccessibleobject.h + qaccessibleplugin.cpp + qaccessibleplugin.h + qaccessible_unix.cpp + qaccessiblewidget.cpp + qaccessiblewidget.h + qaccessible_win.cpp +2 animation/ +0 animation.pri + qguivariantanimation.cpp +2 dialogs/ +0 dialogs.pri + images/ +0 fit-page-24.png + fit-page-32.png + fit-width-24.png + fit-width-32.png + go-first-24.png + go-first-32.png + go-last-24.png + go-last-32.png + go-next-24.png + go-next-32.png + go-previous-24.png + go-previous-32.png + layout-landscape-24.png + layout-landscape-32.png + layout-portrait-24.png + layout-portrait-32.png + page-setup-24.png + page-setup-32.png + print-24.png + print-32.png + qtlogo-64.png + status-color.png + status-gray-scale.png + view-page-multi-24.png + view-page-multi-32.png + view-page-one-24.png + view-page-one-32.png + view-page-sided-24.png + view-page-sided-32.png + zoom-in-24.png + zoom-in-32.png + zoom-out-24.png + zoom-out-32.png +2 qabstractpagesetupdialog.cpp + qabstractpagesetupdialog.h + qabstractpagesetupdialog_p.h + qabstractprintdialog.cpp + qabstractprintdialog.h + qabstractprintdialog_p.h + qcolordialog.cpp + qcolordialog.h + qcolordialog_mac.mm + qcolordialog_p.h + qdialog.cpp + qdialog.h + qdialog_p.h + qdialogsbinarycompat_win.cpp + qerrormessage.cpp + qerrormessage.h + qfiledialog.cpp + qfiledialog_embedded.ui + qfiledialog.h + qfiledialog_mac.mm + qfiledialog_p.h + qfiledialog.ui + qfiledialog_win.cpp + qfileinfogatherer.cpp + qfileinfogatherer_p.h + qfilesystemmodel.cpp + qfilesystemmodel.h + qfilesystemmodel_p.h + qfontdialog.cpp + qfontdialog.h + qfontdialog_mac.mm + qfontdialog_p.h + qfscompleter_p.h + qinputdialog.cpp + qinputdialog.h + qmessagebox.cpp + qmessagebox.h + qmessagebox.qrc + qnspanelproxy_mac.mm + qpagesetupdialog.cpp + qpagesetupdialog.h + qpagesetupdialog_mac.mm + qpagesetupdialog_unix.cpp + qpagesetupdialog_unix_p.h + qpagesetupdialog_win.cpp + qpagesetupwidget.ui + qprintdialog.h + qprintdialog_mac.mm + qprintdialog.qdoc + qprintdialog.qrc + qprintdialog_qws.cpp + qprintdialog_unix.cpp + qprintdialog_win.cpp + qprintpreviewdialog.cpp + qprintpreviewdialog.h + qprintpropertieswidget.ui + qprintsettingsoutput.ui + qprintwidget.ui + qprogressdialog.cpp + qprogressdialog.h + qsidebar.cpp + qsidebar_p.h + qwizard.cpp + qwizard.h + qwizard_win.cpp + qwizard_win_p.h +2 effects/ +0 effects.pri + qgraphicseffect.cpp + qgraphicseffect.h + qgraphicseffect_p.h +2 egl/ +0 egl.pri + qegl.cpp + qegl_p.h + qeglproperties.cpp + qeglproperties_p.h + qegl_qws.cpp + qegl_symbian.cpp + qegl_wince.cpp + qegl_x11.cpp +2 embedded/ +0 directfb.pri + embedded.pri + qcopchannel_qws.cpp + qcopchannel_qws.h + qdecorationdefault_qws.cpp + qdecorationdefault_qws.h + qdecorationfactory_qws.cpp + qdecorationfactory_qws.h + qdecorationplugin_qws.cpp + qdecorationplugin_qws.h + qdecoration_qws.cpp + qdecoration_qws.h + qdecorationstyled_qws.cpp + qdecorationstyled_qws.h + qdecorationwindows_qws.cpp + qdecorationwindows_qws.h + qdirectpainter_qws.cpp + qdirectpainter_qws.h + qkbd_defaultmap_qws_p.h + qkbddriverfactory_qws.cpp + qkbddriverfactory_qws.h + qkbddriverplugin_qws.cpp + qkbddriverplugin_qws.h + qkbdlinuxinput_qws.cpp + qkbdlinuxinput_qws.h + qkbdqnx_qws.cpp + qkbdqnx_qws.h + qkbd_qws.cpp + qkbd_qws.h + qkbd_qws_p.h + qkbdtty_qws.cpp + qkbdtty_qws.h + qkbdum_qws.cpp + qkbdum_qws.h + qkbdvfb_qws.cpp + qkbdvfb_qws.h + qlock.cpp + qlock_p.h + qmousedriverfactory_qws.cpp + qmousedriverfactory_qws.h + qmousedriverplugin_qws.cpp + qmousedriverplugin_qws.h + qmouselinuxinput_qws.cpp + qmouselinuxinput_qws.h + qmouselinuxtp_qws.cpp + qmouselinuxtp_qws.h + qmousepc_qws.cpp + qmousepc_qws.h + qmouseqnx_qws.cpp + qmouseqnx_qws.h + qmouse_qws.cpp + qmouse_qws.h + qmousetslib_qws.cpp + qmousetslib_qws.h + qmousevfb_qws.cpp + qmousevfb_qws.h + qscreendriverfactory_qws.cpp + qscreendriverfactory_qws.h + qscreendriverplugin_qws.cpp + qscreendriverplugin_qws.h + qscreenlinuxfb_qws.cpp + qscreenlinuxfb_qws.h + qscreenmulti_qws.cpp + qscreenmulti_qws_p.h + qscreenproxy_qws.cpp + qscreenproxy_qws.h + qscreenqnx_qws.cpp + qscreenqnx_qws.h + qscreen_qws.cpp + qscreen_qws.h + qscreentransformed_qws.cpp + qscreentransformed_qws.h + qscreenvfb_qws.cpp + qscreenvfb_qws.h + qsoundqss_qws.cpp + qsoundqss_qws.h + qtransportauthdefs_qws.h + qtransportauth_qws.cpp + qtransportauth_qws.h + qtransportauth_qws_p.h + qunixsocket.cpp + qunixsocket_p.h + qunixsocketserver.cpp + qunixsocketserver_p.h + qvfbhdr.h + qwindowsystem_p.h + qwindowsystem_qws.cpp + qwindowsystem_qws.h + qwscommand_qws.cpp + qwscommand_qws_p.h + qwscursor_qws.cpp + qwscursor_qws.h + qwsdisplay_qws.h + qwsdisplay_qws_p.h + qwsembedwidget.cpp + qwsembedwidget.h + qwsevent_qws.cpp + qwsevent_qws.h + qwslock.cpp + qwslock_p.h + qwsmanager_p.h + qwsmanager_qws.cpp + qwsmanager_qws.h + qwsproperty_qws.cpp + qwsproperty_qws.h + qwsprotocolitem_qws.h + qwssharedmemory.cpp + qwssharedmemory_p.h + qwssignalhandler.cpp + qwssignalhandler_p.h + qwssocket_qws.cpp + qwssocket_qws.h + qwsutils_qws.h +2 graphicsview/ +0 graphicsview.pri + qgraphicsanchorlayout.cpp + qgraphicsanchorlayout.h + qgraphicsanchorlayout_p.cpp + qgraphicsanchorlayout_p.h + qgraphicsgridlayout.cpp + qgraphicsgridlayout.h + qgraphicsitemanimation.cpp + qgraphicsitemanimation.h + qgraphicsitem.cpp + qgraphicsitem.h + qgraphicsitem_p.h + qgraphicslayout.cpp + qgraphicslayout.h + qgraphicslayoutitem.cpp + qgraphicslayoutitem.h + qgraphicslayoutitem_p.h + qgraphicslayout_p.cpp + qgraphicslayout_p.h + qgraphicslinearlayout.cpp + qgraphicslinearlayout.h + qgraphicsproxywidget.cpp + qgraphicsproxywidget.h + qgraphicsproxywidget_p.h + qgraphicsscene_bsp.cpp + qgraphicsscene_bsp_p.h + qgraphicsscenebsptreeindex.cpp + qgraphicsscenebsptreeindex_p.h + qgraphicsscene.cpp + qgraphicssceneevent.cpp + qgraphicssceneevent.h + qgraphicsscene.h + qgraphicssceneindex.cpp + qgraphicssceneindex_p.h + qgraphicsscenelinearindex.cpp + qgraphicsscenelinearindex_p.h + qgraphicsscene_p.h + qgraphicstransform.cpp + qgraphicstransform.h + qgraphicstransform_p.h + qgraphicsview.cpp + qgraphicsview.h + qgraphicsview_p.h + qgraphicswidget.cpp + qgraphicswidget.h + qgraphicswidget_p.cpp + qgraphicswidget_p.h + qgraph_p.h + qgridlayoutengine.cpp + qgridlayoutengine_p.h + qsimplex_p.cpp + qsimplex_p.h +2 gui.pro + image/ +0 image.pri + qbitmap.cpp + qbitmap.h + qbmphandler.cpp + qbmphandler_p.h + qicon.cpp + qiconengine.cpp + qiconengine.h + qiconengineplugin.cpp + qiconengineplugin.h + qicon.h + qiconloader.cpp + qiconloader_p.h + qicon_p.h + qimage.cpp + qimage.h + qimageiohandler.cpp + qimageiohandler.h + qimage_p.h + qimagepixmapcleanuphooks.cpp + qimagepixmapcleanuphooks_p.h + qimagereader.cpp + qimagereader.h + qimagewriter.cpp + qimagewriter.h + qmovie.cpp + qmovie.h + qnativeimage.cpp + qnativeimage_p.h + qpaintengine_pic.cpp + qpaintengine_pic_p.h + qpicture.cpp + qpictureformatplugin.cpp + qpictureformatplugin.h + qpicture.h + qpicture_p.h + qpixmapcache.cpp + qpixmapcache.h + qpixmapcache_p.h + qpixmap.cpp + qpixmapdata.cpp + qpixmapdatafactory.cpp + qpixmapdatafactory_p.h + qpixmapdata_p.h + qpixmapfilter.cpp + qpixmapfilter_p.h + qpixmap.h + qpixmap_mac.cpp + qpixmap_mac_p.h + qpixmap_qws.cpp + qpixmap_raster.cpp + qpixmap_raster_p.h + qpixmap_s60.cpp + qpixmap_s60_p.h + qpixmap_win.cpp + qpixmap_x11.cpp + qpixmap_x11_p.h + qpnghandler.cpp + qpnghandler_p.h + qppmhandler.cpp + qppmhandler_p.h + qxbmhandler.cpp + qxbmhandler_p.h + qxpmhandler.cpp + qxpmhandler_p.h +2 inputmethod/ +0 inputmethod.pri + qcoefepinputcontext_p.h + qcoefepinputcontext_s60.cpp + qinputcontext.cpp + qinputcontextfactory.cpp + qinputcontextfactory.h + qinputcontext.h + qinputcontext_p.h + qinputcontextplugin.cpp + qinputcontextplugin.h + qmacinputcontext_mac.cpp + qmacinputcontext_p.h + qwininputcontext_p.h + qwininputcontext_win.cpp + qwsinputcontext_p.h + qwsinputcontext_qws.cpp + qximinputcontext_p.h + qximinputcontext_x11.cpp +2 itemviews/ +0 itemviews.pri + qabstractitemdelegate.cpp + qabstractitemdelegate.h + qabstractitemview.cpp + qabstractitemview.h + qabstractitemview_p.h + qabstractproxymodel.cpp + qabstractproxymodel.h + qabstractproxymodel_p.h + qbsptree.cpp + qbsptree_p.h + qcolumnview.cpp + qcolumnviewgrip.cpp + qcolumnviewgrip_p.h + qcolumnview.h + qcolumnview_p.h + qdatawidgetmapper.cpp + qdatawidgetmapper.h + qdirmodel.cpp + qdirmodel.h + qfileiconprovider.cpp + qfileiconprovider.h + qheaderview.cpp + qheaderview.h + qheaderview_p.h + qitemdelegate.cpp + qitemdelegate.h + qitemeditorfactory.cpp + qitemeditorfactory.h + qitemeditorfactory_p.h + qitemselectionmodel.cpp + qitemselectionmodel.h + qitemselectionmodel_p.h + qlistview.cpp + qlistview.h + qlistview_p.h + qlistwidget.cpp + qlistwidget.h + qlistwidget_p.h + qproxymodel.cpp + qproxymodel.h + qproxymodel_p.h + qsortfilterproxymodel.cpp + qsortfilterproxymodel.h + qstandarditemmodel.cpp + qstandarditemmodel.h + qstandarditemmodel_p.h + qstringlistmodel.cpp + qstringlistmodel.h + qstyleditemdelegate.cpp + qstyleditemdelegate.h + qtableview.cpp + qtableview.h + qtableview_p.h + qtablewidget.cpp + qtablewidget.h + qtablewidget_p.h + qtreeview.cpp + qtreeview.h + qtreeview_p.h + qtreewidget.cpp + qtreewidget.h + qtreewidgetitemiterator.cpp + qtreewidgetitemiterator.h + qtreewidgetitemiterator_p.h + qtreewidget_p.h + qwidgetitemdata_p.h +2 kernel/ +0 kernel.pri + mac.pri + qaction.cpp + qactiongroup.cpp + qactiongroup.h + qaction.h + qaction_p.h + qapplication.cpp + qapplication.h + qapplication_mac.mm + qapplication_p.h + qapplication_qws.cpp + qapplication_s60.cpp + qapplication_win.cpp + qapplication_x11.cpp + qboxlayout.cpp + qboxlayout.h + qclipboard.cpp + qclipboard.h + qclipboard_mac.cpp + qclipboard_p.h + qclipboard_qws.cpp + qclipboard_s60.cpp + qclipboard_win.cpp + qclipboard_x11.cpp + qcocoaapplicationdelegate_mac.mm + qcocoaapplicationdelegate_mac_p.h + qcocoaapplication_mac.mm + qcocoaapplication_mac_p.h + qcocoamenuloader_mac.mm + qcocoamenuloader_mac_p.h + qcocoapanel_mac.mm + qcocoapanel_mac_p.h + qcocoaview_mac.mm + qcocoaview_mac_p.h + qcocoawindowcustomthemeframe_mac.mm + qcocoawindowcustomthemeframe_mac_p.h + qcocoawindowdelegate_mac.mm + qcocoawindowdelegate_mac_p.h + qcocoawindow_mac.mm + qcocoawindow_mac_p.h + qcursor.cpp + qcursor.h + qcursor_mac.mm + qcursor_p.h + qcursor_qws.cpp + qcursor_s60.cpp + qcursor_win.cpp + qcursor_x11.cpp + qdesktopwidget.cpp + qdesktopwidget.h + qdesktopwidget_mac.mm + qdesktopwidget_mac_p.h + qdesktopwidget.qdoc + qdesktopwidget_qws.cpp + qdesktopwidget_s60.cpp + qdesktopwidget_win.cpp + qdesktopwidget_x11.cpp + qdnd.cpp + qdnd_mac.mm + qdnd_p.h + qdnd_qws.cpp + qdnd_s60.cpp + qdnd_win.cpp + qdnd_x11.cpp + qdrag.cpp + qdrag.h + qevent.cpp + qeventdispatcher_glib_qws.cpp + qeventdispatcher_glib_qws_p.h + qeventdispatcher_mac.mm + qeventdispatcher_mac_p.h + qeventdispatcher_qws.cpp + qeventdispatcher_qws_p.h + qeventdispatcher_s60.cpp + qeventdispatcher_s60_p.h + qeventdispatcher_x11.cpp + qeventdispatcher_x11_p.h + qevent.h + qevent_p.h + qformlayout.cpp + qformlayout.h + qgesture.cpp + qgesture.h + qgesturemanager.cpp + qgesturemanager_p.h + qgesture_p.h + qgesturerecognizer.cpp + qgesturerecognizer.h + qgridlayout.cpp + qgridlayout.h + qguieventdispatcher_glib.cpp + qguieventdispatcher_glib_p.h + qguifunctions_wince.cpp + qguifunctions_wince.h + qguiplatformplugin.cpp + qguiplatformplugin_p.h + qguivariant.cpp + qkde.cpp + qkde_p.h + qkeymapper.cpp + qkeymapper_mac.cpp + qkeymapper_p.h + qkeymapper_qws.cpp + qkeymapper_s60.cpp + qkeymapper_win.cpp + qkeymapper_x11.cpp + qkeymapper_x11_p.cpp + qkeysequence.cpp + qkeysequence.h + qkeysequence_p.h + qlayout.cpp + qlayoutengine.cpp + qlayoutengine_p.h + qlayout.h + qlayoutitem.cpp + qlayoutitem.h + qlayout_p.h + qmacdefines_mac.h + qmacgesturerecognizer_mac.mm + qmacgesturerecognizer_mac_p.h + qmime.cpp + qmime.h + qmime_mac.cpp + qmime_win.cpp + qmotifdnd_x11.cpp + qmultitouch_mac.mm + qmultitouch_mac_p.h + qnsframeview_mac_p.h + qnsthemeframe_mac_p.h + qnstitledframe_mac_p.h + qole_win.cpp + qpalette.cpp + qpalette.h + qsessionmanager.h + qsessionmanager_qws.cpp + qshortcut.cpp + qshortcut.h + qshortcutmap.cpp + qshortcutmap_p.h + qsizepolicy.h + qsizepolicy.qdoc + qsoftkeymanager.cpp + qsoftkeymanager_p.h + qsound.cpp + qsound.h + qsound_mac.mm + qsound_p.h + qsound_qws.cpp + qsound_s60.cpp + qsound_win.cpp + qsound_x11.cpp + qstackedlayout.cpp + qstackedlayout.h + qstandardgestures.cpp + qstandardgestures_p.h + qt_cocoa_helpers_mac.mm + qt_cocoa_helpers_mac_p.h + qt_gui_pch.h + qt_mac.cpp + qt_mac_p.h + qtooltip.cpp + qtooltip.h + qt_s60_p.h + qt_x11_p.h + qwhatsthis.cpp + qwhatsthis.h + qwidgetaction.cpp + qwidgetaction.h + qwidgetaction_p.h + qwidget.cpp + qwidgetcreate_x11.cpp + qwidget.h + qwidget_mac.mm + qwidget_p.h + qwidget_qws.cpp + qwidget_s60.cpp + qwidget_wince.cpp + qwidget_win.cpp + qwidget_x11.cpp + qwindowdefs.h + qwindowdefs_win.h + qwinnativepangesturerecognizer_win.cpp + qwinnativepangesturerecognizer_win_p.h + qx11embed_x11.cpp + qx11embed_x11.h + qx11info_x11.cpp + qx11info_x11.h + symbian.pri + win.pri + x11.pri +2 mac/ +0 images/ +0 copyarrowcursor.png + forbiddencursor.png + leopard-unified-toolbar-on.png + pluscursor.png + spincursor.png + waitcursor.png +2 macresources.qrc + qt_menu.nib/ +0 classes.nib + info.nib + keyedobjects.nib +3 math3d/ +0 math3d.pri + qgenericmatrix.cpp + qgenericmatrix.h + qmatrix4x4.cpp + qmatrix4x4.h + qquaternion.cpp + qquaternion.h + qvector2d.cpp + qvector2d.h + qvector3d.cpp + qvector3d.h + qvector4d.cpp + qvector4d.h +2 painting/ +0 makepsheader.pl + painting.pri + qbackingstore.cpp + qbackingstore_p.h + qbezier.cpp + qbezier_p.h + qblendfunctions_armv6_rvct.s + qblendfunctions.cpp + qbrush.cpp + qbrush.h + qcolor.cpp + qcolor.h + qcolormap.h + qcolormap_mac.cpp + qcolormap.qdoc + qcolormap_qws.cpp + qcolormap_s60.cpp + qcolormap_win.cpp + qcolormap_x11.cpp + qcolor_p.cpp + qcolor_p.h + qcssutil.cpp + qcssutil_p.h + qcups.cpp + qcups_p.h + qdatabuffer_p.h + qdrawhelper_armv6_p.h + qdrawhelper_armv6_rvct.inc + qdrawhelper_armv6_rvct.s + qdrawhelper.cpp + qdrawhelper_iwmmxt.cpp + qdrawhelper_mmx3dnow.cpp + qdrawhelper_mmx.cpp + qdrawhelper_mmx_p.h + qdrawhelper_p.h + qdrawhelper_sse2.cpp + qdrawhelper_sse3dnow.cpp + qdrawhelper_sse.cpp + qdrawhelper_sse_p.h + qdrawhelper_x86_p.h + qdrawutil.cpp + qdrawutil.h + qemulationpaintengine.cpp + qemulationpaintengine_p.h + qfixed_p.h + qgraphicssystem.cpp + qgraphicssystemfactory.cpp + qgraphicssystemfactory_p.h + qgraphicssystem_mac.cpp + qgraphicssystem_mac_p.h + qgraphicssystem_p.h + qgraphicssystemplugin.cpp + qgraphicssystemplugin_p.h + qgraphicssystem_qws.cpp + qgraphicssystem_qws_p.h + qgraphicssystem_raster.cpp + qgraphicssystem_raster_p.h + qgrayraster.c + qgrayraster_p.h + qimagescale.cpp + qimagescale_p.h + qmath_p.h + qmatrix.cpp + qmatrix.h + qmemrotate.cpp + qmemrotate_p.h + qoutlinemapper.cpp + qoutlinemapper_p.h + qpaintbuffer.cpp + qpaintbuffer_p.h + qpaintdevice.cpp + qpaintdevice.h + qpaintdevice_mac.cpp + qpaintdevice.qdoc + qpaintdevice_qws.cpp + qpaintdevice_win.cpp + qpaintdevice_x11.cpp + qpaintengine_alpha.cpp + qpaintengine_alpha_p.h + qpaintengine.cpp + qpaintengineex.cpp + qpaintengineex_p.h + qpaintengine.h + qpaintengine_mac.cpp + qpaintengine_mac_p.h + qpaintengine_p.h + qpaintengine_preview.cpp + qpaintengine_preview_p.h + qpaintengine_raster.cpp + qpaintengine_raster_p.h + qpaintengine_s60.cpp + qpaintengine_s60_p.h + qpaintengine_x11.cpp + qpaintengine_x11_p.h + qpainter.cpp + qpainter.h + qpainterpath.cpp + qpainterpath.h + qpainterpath_p.h + qpainter_p.h + qpathclipper.cpp + qpathclipper_p.h + qpdf.cpp + qpdf_p.h + qpen.cpp + qpen.h + qpen_p.h + qpolygonclipper_p.h + qpolygon.cpp + qpolygon.h + qprintengine.h + qprintengine_mac.mm + qprintengine_mac_p.h + qprintengine_pdf.cpp + qprintengine_pdf_p.h + qprintengine_ps.cpp + qprintengine_ps_p.h + qprintengine_qws.cpp + qprintengine_qws_p.h + qprintengine_win.cpp + qprintengine_win_p.h + qprinter.cpp + qprinter.h + qprinterinfo.h + qprinterinfo_mac.cpp + qprinterinfo.qdoc + qprinterinfo_unix.cpp + qprinterinfo_unix_p.h + qprinterinfo_win.cpp + qprinter_p.h + qpsprinter.agl + qpsprinter.ps + qrasterdefs_p.h + qrasterizer.cpp + qrasterizer_p.h + qregion.cpp + qregion.h + qregion_mac.cpp + qregion_qws.cpp + qregion_s60.cpp + qregion_win.cpp + qregion_x11.cpp + qrgb.h + qstroker.cpp + qstroker_p.h + qstylepainter.cpp + qstylepainter.h + qtessellator.cpp + qtessellator_p.h + qtextureglyphcache.cpp + qtextureglyphcache_p.h + qtransform.cpp + qtransform.h + qvectorpath_p.h + qwindowsurface.cpp + qwindowsurface_mac.cpp + qwindowsurface_mac_p.h + qwindowsurface_p.h + qwindowsurface_qws.cpp + qwindowsurface_qws_p.h + qwindowsurface_raster.cpp + qwindowsurface_raster_p.h + qwindowsurface_s60.cpp + qwindowsurface_s60_p.h + qwindowsurface_x11.cpp + qwindowsurface_x11_p.h + qwmatrix.h +2 QtGui.dynlist + s60framework/ +0 qs60mainapplication.cpp + qs60mainapplication.h + qs60mainapplication_p.h + qs60mainappui.cpp + qs60mainappui.h + qs60maindocument.cpp + qs60maindocument.h + s60framework.pri + s60main.rss +2 statemachine/ +0 qbasickeyeventtransition.cpp + qbasickeyeventtransition_p.h + qbasicmouseeventtransition.cpp + qbasicmouseeventtransition_p.h + qguistatemachine.cpp + qkeyeventtransition.cpp + qkeyeventtransition.h + qmouseeventtransition.cpp + qmouseeventtransition.h + statemachine.pri +2 styles/ +0 images/ +0 cdr-128.png + cdr-16.png + cdr-32.png + closedock-16.png + closedock-down-16.png + computer-16.png + computer-32.png + defaults60theme.blob + desktop-16.png + desktop-32.png + dirclosed-128.png + dirclosed-16.png + dirclosed-32.png + dirlink-128.png + dirlink-16.png + dirlink-32.png + diropen-128.png + diropen-16.png + diropen-32.png + dockdock-16.png + dockdock-down-16.png + down-128.png + down-16.png + down-32.png + dvd-128.png + dvd-16.png + dvd-32.png + file-128.png + file-16.png + file-32.png + filecontents-128.png + filecontents-16.png + filecontents-32.png + fileinfo-128.png + fileinfo-16.png + fileinfo-32.png + filelink-128.png + filelink-16.png + filelink-32.png + floppy-128.png + floppy-16.png + floppy-32.png + fontbitmap-16.png + fonttruetype-16.png + harddrive-128.png + harddrive-16.png + harddrive-32.png + left-128.png + left-16.png + left-32.png + media-pause-16.png + media-pause-32.png + media-play-16.png + media-play-32.png + media-seek-backward-16.png + media-seek-backward-32.png + media-seek-forward-16.png + media-seek-forward-32.png + media-skip-backward-16.png + media-skip-backward-32.png + media-skip-forward-16.png + media-skip-forward-32.png + media-stop-16.png + media-stop-32.png + media-volume-16.png + media-volume-muted-16.png + networkdrive-128.png + networkdrive-16.png + networkdrive-32.png + newdirectory-128.png + newdirectory-16.png + newdirectory-32.png + parentdir-128.png + parentdir-16.png + parentdir-32.png + refresh-24.png + refresh-32.png + right-128.png + right-16.png + right-32.png + standardbutton-apply-128.png + standardbutton-apply-16.png + standardbutton-apply-32.png + standardbutton-cancel-128.png + standardbutton-cancel-16.png + standardbutton-cancel-32.png + standardbutton-clear-128.png + standardbutton-clear-16.png + standardbutton-clear-32.png + standardbutton-close-128.png + standardbutton-close-16.png + standardbutton-close-32.png + standardbutton-closetab-16.png + standardbutton-closetab-down-16.png + standardbutton-closetab-hover-16.png + standardbutton-delete-128.png + standardbutton-delete-16.png + standardbutton-delete-32.png + standardbutton-help-128.png + standardbutton-help-16.png + standardbutton-help-32.png + standardbutton-no-128.png + standardbutton-no-16.png + standardbutton-no-32.png + standardbutton-ok-128.png + standardbutton-ok-16.png + standardbutton-ok-32.png + standardbutton-open-128.png + standardbutton-open-16.png + standardbutton-open-32.png + standardbutton-save-128.png + standardbutton-save-16.png + standardbutton-save-32.png + standardbutton-yes-128.png + standardbutton-yes-16.png + standardbutton-yes-32.png + stop-24.png + stop-32.png + trash-128.png + trash-16.png + trash-32.png + up-128.png + up-16.png + up-32.png + viewdetailed-128.png + viewdetailed-16.png + viewdetailed-32.png + viewlist-128.png + viewlist-16.png + viewlist-32.png +2 qcdestyle.cpp + qcdestyle.h + qcleanlooksstyle.cpp + qcleanlooksstyle.h + qcleanlooksstyle_p.h + qcommonstyle.cpp + qcommonstyle.h + qcommonstyle_p.h + qcommonstylepixmaps_p.h + qgtkpainter.cpp + qgtkpainter_p.h + qgtkstyle.cpp + qgtkstyle.h + qgtkstyle_p.cpp + qgtkstyle_p.h + qmacstyle_mac.h + qmacstyle_mac.mm + qmacstylepixmaps_mac_p.h + qmacstyle.qdoc + qmotifstyle.cpp + qmotifstyle.h + qmotifstyle_p.h + qplastiquestyle.cpp + qplastiquestyle.h + qproxystyle.cpp + qproxystyle.h + qproxystyle_p.h + qs60style.cpp + qs60style.h + qs60style_p.h + qs60style_s60.cpp + qs60style_simulated.cpp + qstyle.cpp + qstylefactory.cpp + qstylefactory.h + qstyle.h + qstylehelper.cpp + qstylehelper_p.h + qstyleoption.cpp + qstyleoption.h + qstyle_p.h + qstyleplugin.cpp + qstyleplugin.h + qstyle.qrc + qstyle_s60_simulated.qrc + qstylesheetstyle.cpp + qstylesheetstyle_default.cpp + qstylesheetstyle_p.h + qstyle_wince.qrc + qwindowscestyle.cpp + qwindowscestyle.h + qwindowscestyle_p.h + qwindowsmobilestyle.cpp + qwindowsmobilestyle.h + qwindowsmobilestyle_p.h + qwindowsstyle.cpp + qwindowsstyle.h + qwindowsstyle_p.h + qwindowsvistastyle.cpp + qwindowsvistastyle.h + qwindowsvistastyle_p.h + qwindowsxpstyle.cpp + qwindowsxpstyle.h + qwindowsxpstyle_p.h + styles.pri +2 symbian/ +0 images/ +0 blank.png + busy12.png + busy3.png + busy6.png + busy9.png + closehand.png + cross.png + forbidden.png + handpoint.png + ibeam.png + openhand.png + pointer.png + sizeall.png + sizebdiag.png + sizefdiag.png + sizehor.png + sizever.png + splith.png + splitv.png + uparrow.png + wait10.png + wait11.png + wait12.png + wait1.png + wait2.png + wait3.png + wait4.png + wait5.png + wait6.png + wait7.png + wait8.png + wait9.png + whatsthis.png +2 qsymbianevent.cpp + qsymbianevent.h + symbianresources.qrc +2 text/ +0 qabstractfontengine_p.h + qabstractfontengine_qws.cpp + qabstractfontengine_qws.h + qabstracttextdocumentlayout.cpp + qabstracttextdocumentlayout.h + qabstracttextdocumentlayout_p.h + qcssparser.cpp + qcssparser_p.h + qcssscanner.cpp + qfont.cpp + qfontdatabase.cpp + qfontdatabase.h + qfontdatabase_mac.cpp + qfontdatabase_qws.cpp + qfontdatabase_s60.cpp + qfontdatabase_win.cpp + qfontdatabase_x11.cpp + qfontengine.cpp + qfontengine_ft.cpp + qfontengine_ft_p.h + qfontengineglyphcache_p.h + qfontengine_mac.mm + qfontengine_p.h + qfontengine_qpf.cpp + qfontengine_qpf_p.h + qfontengine_qws.cpp + qfontengine_s60.cpp + qfontengine_s60_p.h + qfontengine_win.cpp + qfontengine_win_p.h + qfontengine_x11.cpp + qfontengine_x11_p.h + qfont.h + qfontinfo.h + qfont_mac.cpp + qfontmetrics.cpp + qfontmetrics.h + qfont_p.h + qfont_qws.cpp + qfont_s60.cpp + qfontsubset.cpp + qfontsubset_p.h + qfont_win.cpp + qfont_x11.cpp + qfragmentmap.cpp + qfragmentmap_p.h + qpfutil.cpp + qsyntaxhighlighter.cpp + qsyntaxhighlighter.h + qtextcontrol.cpp + qtextcontrol_p.h + qtextcontrol_p_p.h + qtextcursor.cpp + qtextcursor.h + qtextcursor_p.h + qtextdocument.cpp + qtextdocumentfragment.cpp + qtextdocumentfragment.h + qtextdocumentfragment_p.h + qtextdocument.h + qtextdocumentlayout.cpp + qtextdocumentlayout_p.h + qtextdocument_p.cpp + qtextdocument_p.h + qtextdocumentwriter.cpp + qtextdocumentwriter.h + qtextengine.cpp + qtextengine_mac.cpp + qtextengine_p.h + qtextformat.cpp + qtextformat.h + qtextformat_p.h + qtexthtmlparser.cpp + qtexthtmlparser_p.h + qtextimagehandler.cpp + qtextimagehandler_p.h + qtextlayout.cpp + qtextlayout.h + qtextlist.cpp + qtextlist.h + qtextobject.cpp + qtextobject.h + qtextobject_p.h + qtextodfwriter.cpp + qtextodfwriter_p.h + qtextoption.cpp + qtextoption.h + qtexttable.cpp + qtexttable.h + qtexttable_p.h + qzip.cpp + qzipreader_p.h + qzipwriter_p.h + text.pri +2 util/ +0 qcompleter.cpp + qcompleter.h + qcompleter_p.h + qdesktopservices.cpp + qdesktopservices.h + qdesktopservices_mac.cpp + qdesktopservices_qws.cpp + qdesktopservices_s60.cpp + qdesktopservices_win.cpp + qdesktopservices_x11.cpp + qsystemtrayicon.cpp + qsystemtrayicon.h + qsystemtrayicon_mac.mm + qsystemtrayicon_p.h + qsystemtrayicon_qws.cpp + qsystemtrayicon_win.cpp + qsystemtrayicon_x11.cpp + qundogroup.cpp + qundogroup.h + qundostack.cpp + qundostack.h + qundostack_p.h + qundoview.cpp + qundoview.h + util.pri +2 widgets/ +0 qabstractbutton.cpp + qabstractbutton.h + qabstractbutton_p.h + qabstractscrollarea.cpp + qabstractscrollarea.h + qabstractscrollarea_p.h + qabstractslider.cpp + qabstractslider.h + qabstractslider_p.h + qabstractspinbox.cpp + qabstractspinbox.h + qabstractspinbox_p.h + qbuttongroup.cpp + qbuttongroup.h + qcalendartextnavigator_p.h + qcalendarwidget.cpp + qcalendarwidget.h + qcheckbox.cpp + qcheckbox.h + qcocoamenu_mac.mm + qcocoamenu_mac_p.h + qcocoatoolbardelegate_mac.mm + qcocoatoolbardelegate_mac_p.h + qcombobox.cpp + qcombobox.h + qcombobox_p.h + qcommandlinkbutton.cpp + qcommandlinkbutton.h + qdatetimeedit.cpp + qdatetimeedit.h + qdatetimeedit_p.h + qdial.cpp + qdial.h + qdialogbuttonbox.cpp + qdialogbuttonbox.h + qdockarealayout.cpp + qdockarealayout_p.h + qdockwidget.cpp + qdockwidget.h + qdockwidget_p.h + qeffects.cpp + qeffects_p.h + qfocusframe.cpp + qfocusframe.h + qfontcombobox.cpp + qfontcombobox.h + qframe.cpp + qframe.h + qframe_p.h + qgroupbox.cpp + qgroupbox.h + qlabel.cpp + qlabel.h + qlabel_p.h + qlcdnumber.cpp + qlcdnumber.h + qlinecontrol.cpp + qlinecontrol_p.h + qlineedit.cpp + qlineedit.h + qlineedit_p.cpp + qlineedit_p.h + qmaccocoaviewcontainer_mac.h + qmaccocoaviewcontainer_mac.mm + qmacnativewidget_mac.h + qmacnativewidget_mac.mm + qmainwindow.cpp + qmainwindow.h + qmainwindowlayout.cpp + qmainwindowlayout_mac.mm + qmainwindowlayout_p.h + qmdiarea.cpp + qmdiarea.h + qmdiarea_p.h + qmdisubwindow.cpp + qmdisubwindow.h + qmdisubwindow_p.h + qmenubar.cpp + qmenubar.h + qmenubar_p.h + qmenu.cpp + qmenudata.cpp + qmenudata.h + qmenu.h + qmenu_mac.mm + qmenu_p.h + qmenu_symbian.cpp + qmenu_wince.cpp + qmenu_wince.rc + qmenu_wince_resource_p.h + qplaintextedit.cpp + qplaintextedit.h + qplaintextedit_p.h + qprintpreviewwidget.cpp + qprintpreviewwidget.h + qprogressbar.cpp + qprogressbar.h + qpushbutton.cpp + qpushbutton.h + qpushbutton_p.h + qradiobutton.cpp + qradiobutton.h + qrubberband.cpp + qrubberband.h + qscrollarea.cpp + qscrollarea.h + qscrollarea_p.h + qscrollbar.cpp + qscrollbar.h + qsizegrip.cpp + qsizegrip.h + qslider.cpp + qslider.h + qspinbox.cpp + qspinbox.h + qsplashscreen.cpp + qsplashscreen.h + qsplitter.cpp + qsplitter.h + qsplitter_p.h + qstackedwidget.cpp + qstackedwidget.h + qstatusbar.cpp + qstatusbar.h + qtabbar.cpp + qtabbar.h + qtabbar_p.h + qtabwidget.cpp + qtabwidget.h + qtextbrowser.cpp + qtextbrowser.h + qtextedit.cpp + qtextedit.h + qtextedit_p.h + qtoolbararealayout.cpp + qtoolbararealayout_p.h + qtoolbar.cpp + qtoolbarextension.cpp + qtoolbarextension_p.h + qtoolbar.h + qtoolbarlayout.cpp + qtoolbarlayout_p.h + qtoolbar_p.h + qtoolbarseparator.cpp + qtoolbarseparator_p.h + qtoolbox.cpp + qtoolbox.h + qtoolbutton.cpp + qtoolbutton.h + qvalidator.cpp + qvalidator.h + qwidgetanimator.cpp + qwidgetanimator_p.h + qwidgetresizehandler.cpp + qwidgetresizehandler_p.h + qworkspace.cpp + qworkspace.h + widgets.pri +3 multimedia/ +0 audio/ +0 audio.pri + qaudio.cpp + qaudiodevicefactory.cpp + qaudiodevicefactory_p.h + qaudiodeviceinfo_alsa_p.cpp + qaudiodeviceinfo_alsa_p.h + qaudiodeviceinfo.cpp + qaudiodeviceinfo.h + qaudiodeviceinfo_mac_p.cpp + qaudiodeviceinfo_mac_p.h + qaudiodeviceinfo_win32_p.cpp + qaudiodeviceinfo_win32_p.h + qaudioengine.cpp + qaudioengine.h + qaudioengineplugin.cpp + qaudioengineplugin.h + qaudioformat.cpp + qaudioformat.h + qaudio.h + qaudioinput_alsa_p.cpp + qaudioinput_alsa_p.h + qaudioinput.cpp + qaudioinput.h + qaudioinput_mac_p.cpp + qaudioinput_mac_p.h + qaudioinput_win32_p.cpp + qaudioinput_win32_p.h + qaudio_mac.cpp + qaudio_mac_p.h + qaudiooutput_alsa_p.cpp + qaudiooutput_alsa_p.h + qaudiooutput.cpp + qaudiooutput.h + qaudiooutput_mac_p.cpp + qaudiooutput_mac_p.h + qaudiooutput_win32_p.cpp + qaudiooutput_win32_p.h +2 multimedia.pro + video/ +0 qabstractvideobuffer.cpp + qabstractvideobuffer.h + qabstractvideobuffer_p.h + qabstractvideosurface.cpp + qabstractvideosurface.h + qabstractvideosurface_p.h + qimagevideobuffer.cpp + qimagevideobuffer_p.h + qmemoryvideobuffer.cpp + qmemoryvideobuffer_p.h + qvideoframe.cpp + qvideoframe.h + qvideosurfaceformat.cpp + qvideosurfaceformat.h + video.pri +3 network/ +0 access/ +0 access.pri + qabstractnetworkcache.cpp + qabstractnetworkcache.h + qabstractnetworkcache_p.h + qftp.cpp + qftp.h + qhttp.cpp + qhttp.h + qhttpnetworkconnectionchannel.cpp + qhttpnetworkconnectionchannel_p.h + qhttpnetworkconnection.cpp + qhttpnetworkconnection_p.h + qhttpnetworkheader.cpp + qhttpnetworkheader_p.h + qhttpnetworkreply.cpp + qhttpnetworkreply_p.h + qhttpnetworkrequest.cpp + qhttpnetworkrequest_p.h + qnetworkaccessbackend.cpp + qnetworkaccessbackend_p.h + qnetworkaccesscachebackend.cpp + qnetworkaccesscachebackend_p.h + qnetworkaccesscache.cpp + qnetworkaccesscache_p.h + qnetworkaccessdatabackend.cpp + qnetworkaccessdatabackend_p.h + qnetworkaccessdebugpipebackend.cpp + qnetworkaccessdebugpipebackend_p.h + qnetworkaccessfilebackend.cpp + qnetworkaccessfilebackend_p.h + qnetworkaccessftpbackend.cpp + qnetworkaccessftpbackend_p.h + qnetworkaccesshttpbackend.cpp + qnetworkaccesshttpbackend_p.h + qnetworkaccessmanager.cpp + qnetworkaccessmanager.h + qnetworkaccessmanager_p.h + qnetworkcookie.cpp + qnetworkcookie.h + qnetworkcookiejar.cpp + qnetworkcookiejar.h + qnetworkcookiejar_p.h + qnetworkcookie_p.h + qnetworkdiskcache.cpp + qnetworkdiskcache.h + qnetworkdiskcache_p.h + qnetworkreply.cpp + qnetworkreply.h + qnetworkreplyimpl.cpp + qnetworkreplyimpl_p.h + qnetworkreply_p.h + qnetworkrequest.cpp + qnetworkrequest.h + qnetworkrequest_p.h +2 kernel/ +0 kernel.pri + qauthenticator.cpp + qauthenticator.h + qauthenticator_p.h + qhostaddress.cpp + qhostaddress.h + qhostaddress_p.h + qhostinfo.cpp + qhostinfo.h + qhostinfo_p.h + qhostinfo_unix.cpp + qhostinfo_win.cpp + qnetworkinterface.cpp + qnetworkinterface.h + qnetworkinterface_p.h + qnetworkinterface_symbian.cpp + qnetworkinterface_unix.cpp + qnetworkinterface_win.cpp + qnetworkinterface_win_p.h + qnetworkproxy.cpp + qnetworkproxy_generic.cpp + qnetworkproxy.h + qnetworkproxy_mac.cpp + qnetworkproxy_p.h + qnetworkproxy_win.cpp + qurlinfo.cpp + qurlinfo.h +2 network.pro + network.qrc + socket/ +0 qabstractsocket.cpp + qabstractsocketengine.cpp + qabstractsocketengine_p.h + qabstractsocket.h + qabstractsocket_p.h + qhttpsocketengine.cpp + qhttpsocketengine_p.h + qlocalserver.cpp + qlocalserver.h + qlocalserver_p.h + qlocalserver_tcp.cpp + qlocalserver_unix.cpp + qlocalserver_win.cpp + qlocalsocket.cpp + qlocalsocket.h + qlocalsocket_p.h + qlocalsocket_tcp.cpp + qlocalsocket_unix.cpp + qlocalsocket_win.cpp + qnativesocketengine.cpp + qnativesocketengine_p.h + qnativesocketengine_unix.cpp + qnativesocketengine_win.cpp + qnet_unix_p.h + qsocks5socketengine.cpp + qsocks5socketengine_p.h + qtcpserver.cpp + qtcpserver.h + qtcpsocket.cpp + qtcpsocket.h + qtcpsocket_p.h + qudpsocket.cpp + qudpsocket.h + socket.pri +2 ssl/ +0 qsslcertificate.cpp + qsslcertificate.h + qsslcertificate_p.h + qsslcipher.cpp + qsslcipher.h + qsslcipher_p.h + qsslconfiguration.cpp + qsslconfiguration.h + qsslconfiguration_p.h + qssl.cpp + qsslerror.cpp + qsslerror.h + qssl.h + qsslkey.cpp + qsslkey.h + qsslkey_p.h + qsslsocket.cpp + qsslsocket.h + qsslsocket_openssl.cpp + qsslsocket_openssl_p.h + qsslsocket_openssl_symbols.cpp + qsslsocket_openssl_symbols_p.h + qsslsocket_p.h + qt-ca-bundle.crt + ssl.pri +3 opengl/ +0 gl2paintengineex/ +0 qgl2pexvertexarray.cpp + qgl2pexvertexarray_p.h + qglcustomshaderstage.cpp + qglcustomshaderstage_p.h + qglengineshadermanager.cpp + qglengineshadermanager_p.h + qglengineshadersource_p.h + qglgradientcache.cpp + qglgradientcache_p.h + qpaintengineex_opengl2.cpp + qpaintengineex_opengl2_p.h + qtriangulatingstroker.cpp + qtriangulatingstroker_p.h +2 opengl.pro + qgl_cl_p.h + qglcolormap.cpp + qglcolormap.h + qgl.cpp + qgl_egl.cpp + qgl_egl_p.h + qglextensions.cpp + qglextensions_p.h + qglframebufferobject.cpp + qglframebufferobject.h + qglframebufferobject_p.h + qgl.h + qgl_mac.mm + qglpaintdevice.cpp + qglpaintdevice_p.h + qgl_p.h + qglpixelbuffer.cpp + qglpixelbuffer_egl.cpp + qglpixelbuffer.h + qglpixelbuffer_mac.mm + qglpixelbuffer_p.h + qglpixelbuffer_win.cpp + qglpixelbuffer_x11.cpp + qglpixmapfilter.cpp + qglpixmapfilter_p.h + qgl_qws.cpp + qglscreen_qws.cpp + qglscreen_qws.h + qglshaderprogram.cpp + qglshaderprogram.h + qgl_wince.cpp + qgl_win.cpp + qglwindowsurface_qws.cpp + qglwindowsurface_qws_p.h + qgl_x11.cpp + qgl_x11egl.cpp + qgraphicsshadereffect.cpp + qgraphicsshadereffect_p.h + qgraphicssystem_gl.cpp + qgraphicssystem_gl_p.h + qpaintengine_opengl.cpp + qpaintengine_opengl_p.h + qpixmapdata_gl.cpp + qpixmapdata_gl_p.h + qpixmapdata_x11gl_egl.cpp + qpixmapdata_x11gl_p.h + qwindowsurface_gl.cpp + qwindowsurface_gl_p.h + qwindowsurface_x11gl.cpp + qwindowsurface_x11gl_p.h + util/ +0 brushes.conf + brush_painter.glsl + composition_mode_colorburn.glsl + composition_mode_colordodge.glsl + composition_mode_darken.glsl + composition_mode_difference.glsl + composition_mode_exclusion.glsl + composition_mode_hardlight.glsl + composition_mode_lighten.glsl + composition_mode_multiply.glsl + composition_mode_overlay.glsl + composition_modes.conf + composition_mode_screen.glsl + composition_mode_softlight.glsl + conical_brush.glsl + ellipse_aa.glsl + fast_painter.glsl + fragmentprograms_p.h + generator.cpp + generator.pro + glsl_to_include.sh + linear_brush.glsl + masks.conf + painter.glsl + painter_nomask.glsl + pattern_brush.glsl + radial_brush.glsl + README-GLSL + simple_porter_duff.glsl + solid_brush.glsl + texture_brush.glsl + trap_exact_aa.glsl +3 openvg/ +0 openvg.pro + qpaintengine_vg.cpp + qpaintengine_vg_p.h + qpixmapdata_vg.cpp + qpixmapdata_vg_p.h + qpixmapfilter_vg.cpp + qpixmapfilter_vg_p.h + qvgcompositionhelper_p.h + qvg.h + qvg_p.h + qwindowsurface_vg.cpp + qwindowsurface_vgegl.cpp + qwindowsurface_vgegl_p.h + qwindowsurface_vg_p.h +2 phonon/ +0 phonon.pro +2 plugins/ +0 accessible/ +0 accessible.pro + compat/ +0 compat.pro + main.cpp + q3complexwidgets.cpp + q3complexwidgets.h + q3simplewidgets.cpp + q3simplewidgets.h + qaccessiblecompat.cpp + qaccessiblecompat.h +2 qaccessiblebase.pri + widgets/ +0 complexwidgets.cpp + complexwidgets.h + main.cpp + qaccessiblemenu.cpp + qaccessiblemenu.h + qaccessiblewidgets.cpp + qaccessiblewidgets.h + rangecontrols.cpp + rangecontrols.h + simplewidgets.cpp + simplewidgets.h + widgets.pro +3 audio/ +0 audio.pro +2 codecs/ +0 cn/ +0 cn.pro + main.cpp + qgb18030codec.cpp + qgb18030codec.h +2 codecs.pro + jp/ +0 jp.pro + main.cpp + qeucjpcodec.cpp + qeucjpcodec.h + qfontjpcodec.cpp + qfontjpcodec.h + qjiscodec.cpp + qjiscodec.h + qjpunicode.cpp + qjpunicode.h + qsjiscodec.cpp + qsjiscodec.h +2 kr/ +0 cp949codetbl.h + kr.pro + main.cpp + qeuckrcodec.cpp + qeuckrcodec.h +2 tw/ +0 main.cpp + qbig5codec.cpp + qbig5codec.h + tw.pro +3 decorations/ +0 decorations.pro + default/ +0 default.pro + main.cpp +2 styled/ +0 main.cpp + styled.pro +2 windows/ +0 main.cpp + windows.pro +3 gfxdrivers/ +0 ahi/ +0 ahi.pro + qscreenahiplugin.cpp + qscreenahi_qws.cpp + qscreenahi_qws.h +2 directfb/ +0 directfb.pro + qdirectfbkeyboard.cpp + qdirectfbkeyboard.h + qdirectfbmouse.cpp + qdirectfbmouse.h + qdirectfbpaintdevice.cpp + qdirectfbpaintdevice.h + qdirectfbpaintengine.cpp + qdirectfbpaintengine.h + qdirectfbpixmap.cpp + qdirectfbpixmap.h + qdirectfbscreen.cpp + qdirectfbscreen.h + qdirectfbscreenplugin.cpp + qdirectfbwindowsurface.cpp + qdirectfbwindowsurface.h +2 gfxdrivers.pro + linuxfb/ +0 linuxfb.pro + main.cpp +2 powervr/ +0 powervr.pri + powervr.pro + pvreglscreen/ +0 pvreglscreen.cpp + pvreglscreen.h + pvreglscreenplugin.cpp + pvreglscreen.pro + pvreglwindowsurface.cpp + pvreglwindowsurface.h +2 QWSWSEGL/ +0 pvrqwsdrawable.c + pvrqwsdrawable.h + pvrqwsdrawable_p.h + pvrqwswsegl.c + QWSWSEGL.pro +2 README +2 qvfb/ +0 main.cpp + qvfb.pro +2 transformed/ +0 main.cpp + transformed.pro +2 vnc/ +0 main.cpp + qscreenvnc_p.h + qscreenvnc_qws.cpp + qscreenvnc_qws.h + vnc.pro +3 graphicssystems/ +0 graphicssystems.pro + opengl/ +0 main.cpp + opengl.pro +2 openvg/ +0 main.cpp + openvg.pro + qgraphicssystem_vg.cpp + qgraphicssystem_vg_p.h +2 shivavg/ +0 main.cpp + README + shivavggraphicssystem.cpp + shivavggraphicssystem.h + shivavg.pro + shivavgwindowsurface.cpp + shivavgwindowsurface.h +2 trace/ +0 main.cpp + qgraphicssystem_trace.cpp + qgraphicssystem_trace_p.h + trace.pro +3 iconengines/ +0 iconengines.pro + svgiconengine/ +0 main.cpp + qsvgiconengine.cpp + qsvgiconengine.h + svgiconengine.pro +3 imageformats/ +0 gif/ +0 gif.pro + main.cpp + qgifhandler.cpp + qgifhandler.h +2 ico/ +0 ico.pro + main.cpp + qicohandler.cpp + qicohandler.h +2 imageformats.pro + jpeg/ +0 jpeg.pro + main.cpp + qjpeghandler.cpp + qjpeghandler.h +2 mng/ +0 main.cpp + mng.pro + qmnghandler.cpp + qmnghandler.h +2 svg/ +0 main.cpp + qsvgiohandler.cpp + qsvgiohandler.h + svg.pro +2 tiff/ +0 main.cpp + qtiffhandler.cpp + qtiffhandler.h + tiff.pro +3 inputmethods/ +0 imsw-multi/ +0 imsw-multi.pro + qmultiinputcontext.cpp + qmultiinputcontext.h + qmultiinputcontextplugin.cpp + qmultiinputcontextplugin.h +2 inputmethods.pro +2 kbddrivers/ +0 kbddrivers.pro + linuxinput/ +0 linuxinput.pro + main.cpp +3 mousedrivers/ +0 linuxtp/ +0 linuxtp.pro + main.cpp +2 mousedrivers.pro + pc/ +0 main.cpp + pc.pro +2 tslib/ +0 main.cpp + tslib.pro +3 phonon/ +0 ds9/ +0 ds9.pro +2 gstreamer/ +0 gstreamer.pro +2 mmf/ +0 mmf.pro +2 phonon.pro + qt7/ +0 qt7.pro +2 waveout/ +0 waveout.pro +3 plugins.pro + qpluginbase.pri + s60/ +0 3_1/ +0 3_1.pro +2 3_2/ +0 3_2.pro +2 5_0/ +0 5_0.pro +2 bwins/ +0 qts60pluginu.def +2 eabi/ +0 qts60pluginu.def +2 s60pluginbase.pri + s60.pro + src/ +0 qcoreapplication_3_1.cpp + qcoreapplication_3_2.cpp + qdesktopservices_3_1.cpp + qdesktopservices_3_2.cpp + qlocale_3_1.cpp + qlocale_3_2.cpp +3 script/ +0 qtdbus/ +0 main.cpp + main.h + qtdbus.pro +2 script.pro +2 sqldrivers/ +0 db2/ +0 db2.pro + main.cpp + README +2 ibase/ +0 ibase.pro + main.cpp +2 mysql/ +0 main.cpp + mysql.pro + README +2 oci/ +0 main.cpp + oci.pro + README +2 odbc/ +0 main.cpp + odbc.pro + README +2 psql/ +0 main.cpp + psql.pro + README +2 qsqldriverbase.pri + README + sqldrivers.pro + sqlite/ + sqlite2/ +0 README + smain.cpp + sqlite2.pro +2 sqlite/README + sqlite/smain.cpp + sqlite/sqlite.pro + sqlite_symbian/ +0 SQLite3_v9.2.zip + sqlite_symbian.pro +2 tds/ +0 main.cpp + README + tds.pro +4 qbase.pri + qt3support/ +0 canvas/ +0 canvas.pri + q3canvas.cpp + q3canvas.h +2 dialogs/ +0 dialogs.pri + q3filedialog.cpp + q3filedialog.h + q3filedialog_mac.cpp + q3filedialog_win.cpp + q3progressdialog.cpp + q3progressdialog.h + q3tabdialog.cpp + q3tabdialog.h + q3wizard.cpp + q3wizard.h +2 itemviews/ +0 itemviews.pri + q3iconview.cpp + q3iconview.h + q3listbox.cpp + q3listbox.h + q3listview.cpp + q3listview.h + q3table.cpp + q3table.h +2 network/ +0 network.pri + q3dns.cpp + q3dns.h + q3ftp.cpp + q3ftp.h + q3http.cpp + q3http.h + q3localfs.cpp + q3localfs.h + q3network.cpp + q3network.h + q3networkprotocol.cpp + q3networkprotocol.h + q3serversocket.cpp + q3serversocket.h + q3socket.cpp + q3socketdevice.cpp + q3socketdevice.h + q3socketdevice_unix.cpp + q3socketdevice_win.cpp + q3socket.h + q3url.cpp + q3url.h + q3urloperator.cpp + q3urloperator.h +2 other/ +0 other.pri + q3accel.cpp + q3accel.h + q3boxlayout.cpp + q3boxlayout.h + q3dragobject.cpp + q3dragobject.h + q3dropsite.cpp + q3dropsite.h + q3gridlayout.h + q3membuf.cpp + q3membuf_p.h + q3mimefactory.cpp + q3mimefactory.h + q3polygonscanner.cpp + q3polygonscanner.h + q3process.cpp + q3process.h + q3process_unix.cpp + q3process_win.cpp + qiconset.h + qt_compat_pch.h +2 painting/ +0 painting.pri + q3paintdevicemetrics.cpp + q3paintdevicemetrics.h + q3paintengine_svg.cpp + q3paintengine_svg_p.h + q3painter.cpp + q3painter.h + q3picture.cpp + q3picture.h + q3pointarray.cpp + q3pointarray.h +2 qt3support.pro + sql/ +0 q3databrowser.cpp + q3databrowser.h + q3datatable.cpp + q3datatable.h + q3dataview.cpp + q3dataview.h + q3editorfactory.cpp + q3editorfactory.h + q3sqlcursor.cpp + q3sqlcursor.h + q3sqleditorfactory.cpp + q3sqleditorfactory.h + q3sqlfieldinfo.h + q3sqlfieldinfo.qdoc + q3sqlform.cpp + q3sqlform.h + q3sqlmanager_p.cpp + q3sqlmanager_p.h + q3sqlpropertymap.cpp + q3sqlpropertymap.h + q3sqlrecordinfo.h + q3sqlrecordinfo.qdoc + q3sqlselectcursor.cpp + q3sqlselectcursor.h + sql.pri +2 text/ +0 q3multilineedit.cpp + q3multilineedit.h + q3richtext.cpp + q3richtext_p.cpp + q3richtext_p.h + q3simplerichtext.cpp + q3simplerichtext.h + q3stylesheet.cpp + q3stylesheet.h + q3syntaxhighlighter.cpp + q3syntaxhighlighter.h + q3syntaxhighlighter_p.h + q3textbrowser.cpp + q3textbrowser.h + q3textedit.cpp + q3textedit.h + q3textstream.cpp + q3textstream.h + q3textview.cpp + q3textview.h + text.pri +2 tools/ +0 q3asciicache.h + q3asciicache.qdoc + q3asciidict.h + q3asciidict.qdoc + q3cache.h + q3cache.qdoc + q3cleanuphandler.h + q3cstring.cpp + q3cstring.h + q3deepcopy.cpp + q3deepcopy.h + q3dict.h + q3dict.qdoc + q3garray.cpp + q3garray.h + q3gcache.cpp + q3gcache.h + q3gdict.cpp + q3gdict.h + q3glist.cpp + q3glist.h + q3gvector.cpp + q3gvector.h + q3intcache.h + q3intcache.qdoc + q3intdict.h + q3intdict.qdoc + q3memarray.h + q3memarray.qdoc + q3objectdict.h + q3ptrcollection.cpp + q3ptrcollection.h + q3ptrdict.h + q3ptrdict.qdoc + q3ptrlist.h + q3ptrlist.qdoc + q3ptrqueue.h + q3ptrqueue.qdoc + q3ptrstack.h + q3ptrstack.qdoc + q3ptrvector.h + q3ptrvector.qdoc + q3semaphore.cpp + q3semaphore.h + q3shared.cpp + q3shared.h + q3signal.cpp + q3signal.h + q3sortedlist.h + q3strlist.h + q3strvec.h + q3tl.h + q3valuelist.h + q3valuelist.qdoc + q3valuestack.h + q3valuestack.qdoc + q3valuevector.h + q3valuevector.qdoc + tools.pri +2 widgets/ +0 q3action.cpp + q3action.h + q3button.cpp + q3buttongroup.cpp + q3buttongroup.h + q3button.h + q3combobox.cpp + q3combobox.h + q3datetimeedit.cpp + q3datetimeedit.h + q3dockarea.cpp + q3dockarea.h + q3dockwindow.cpp + q3dockwindow.h + q3frame.cpp + q3frame.h + q3grid.cpp + q3grid.h + q3gridview.cpp + q3gridview.h + q3groupbox.cpp + q3groupbox.h + q3hbox.cpp + q3hbox.h + q3header.cpp + q3header.h + q3hgroupbox.cpp + q3hgroupbox.h + q3mainwindow.cpp + q3mainwindow.h + q3mainwindow_p.h + q3popupmenu.cpp + q3popupmenu.h + q3progressbar.cpp + q3progressbar.h + q3rangecontrol.cpp + q3rangecontrol.h + q3scrollview.cpp + q3scrollview.h + q3spinwidget.cpp + q3titlebar.cpp + q3titlebar_p.h + q3toolbar.cpp + q3toolbar.h + q3vbox.cpp + q3vbox.h + q3vgroupbox.cpp + q3vgroupbox.h + q3whatsthis.cpp + q3whatsthis.h + q3widgetstack.cpp + q3widgetstack.h + widgets.pri +3 qt_install.pri + qt_targets.pri + s60installs/ +0 bwins/ +0 phononu.def + QtCoreu.def + QtGuiu.def + QtMultimediau.def + QtNetworku.def + QtScriptu.def + QtSqlu.def + QtSvgu.def + QtTestu.def + QtWebKitu.def + QtXmlPatternsu.def + QtXmlu.def +2 eabi/ +0 phononu.def + QtCoreu.def + QtGuiu.def + QtMultimediau.def + QtNetworku.def + QtOpenVGu.def + QtScriptu.def + QtSqlu.def + QtSvgu.def + QtTestu.def + QtWebKitu.def + QtXmlPatternsu.def + QtXmlu.def +2 .gitignore + qtdemoapps.iby + qt.iby + qt.svg + s60installs.pro + selfsigned.cer + selfsigned.key +2 s60main/ +0 qts60main.cpp + qts60main_mcrt0.cpp + s60main.pro +2 script/ +0 api/ +0 api.pri + qscriptable.cpp + qscriptable.h + qscriptable_p.h + qscriptclass.cpp + qscriptclass.h + qscriptclasspropertyiterator.cpp + qscriptclasspropertyiterator.h + qscriptcontext.cpp + qscriptcontext.h + qscriptcontextinfo.cpp + qscriptcontextinfo.h + qscriptcontext_p.h + qscriptengineagent.cpp + qscriptengineagent.h + qscriptengineagent_p.h + qscriptengine.cpp + qscriptengine.h + qscriptengine_p.h + qscriptextensioninterface.h + qscriptextensionplugin.cpp + qscriptextensionplugin.h + qscriptprogram.cpp + qscriptprogram.h + qscriptprogram_p.h + qscriptstring.cpp + qscriptstring.h + qscriptstring_p.h + qscriptvalue.cpp + qscriptvalue.h + qscriptvalueiterator.cpp + qscriptvalueiterator.h + qscriptvalue_p.h +2 bridge/ +0 bridge.pri + qscriptactivationobject.cpp + qscriptactivationobject_p.h + qscriptclassobject.cpp + qscriptclassobject_p.h + qscriptdeclarativeclass.cpp + qscriptdeclarativeclass_p.h + qscriptdeclarativeobject.cpp + qscriptdeclarativeobject_p.h + qscriptfunction.cpp + qscriptfunction_p.h + qscriptglobalobject.cpp + qscriptglobalobject_p.h + qscriptobject.cpp + qscriptobject_p.h + qscriptqobject.cpp + qscriptqobject_p.h + qscriptvariant.cpp + qscriptvariant_p.h +2 parser/ +0 parser.pri + qscriptast.cpp + qscriptastfwd_p.h + qscriptast_p.h + qscriptastvisitor.cpp + qscriptastvisitor_p.h + qscript.g + qscriptgrammar.cpp + qscriptgrammar_p.h + qscriptlexer.cpp + qscriptlexer_p.h + qscriptparser.cpp + qscriptparser_p.h + qscriptsyntaxchecker.cpp + qscriptsyntaxchecker_p.h +2 script.pri + script.pro +2 scripttools/ +0 debugging/ +0 debugging.pri + images/ +0 breakpoint.png + breakpoint.svg + d_breakpoint.png + d_breakpoint.svg + delete.png + d_interrupt.png + d_play.png + find.png + interrupt.png + location.png + location.svg + mac/ +0 closetab.png + next.png + plus.png + previous.png +2 new.png + play.png + reload.png + return.png + runtocursor.png + runtonewscript.png + stepinto.png + stepout.png + stepover.png + win/ +0 closetab.png + next.png + plus.png + previous.png +2 wrap.png +2 qscriptbreakpointdata.cpp + qscriptbreakpointdata_p.h + qscriptbreakpointsmodel.cpp + qscriptbreakpointsmodel_p.h + qscriptbreakpointswidget.cpp + qscriptbreakpointswidgetinterface.cpp + qscriptbreakpointswidgetinterface_p.h + qscriptbreakpointswidgetinterface_p_p.h + qscriptbreakpointswidget_p.h + qscriptcompletionproviderinterface_p.h + qscriptcompletiontask.cpp + qscriptcompletiontaskinterface.cpp + qscriptcompletiontaskinterface_p.h + qscriptcompletiontaskinterface_p_p.h + qscriptcompletiontask_p.h + qscriptdebuggeragent.cpp + qscriptdebuggeragent_p.h + qscriptdebuggeragent_p_p.h + qscriptdebuggerbackend.cpp + qscriptdebuggerbackend_p.h + qscriptdebuggerbackend_p_p.h + qscriptdebuggercodefinderwidget.cpp + qscriptdebuggercodefinderwidgetinterface.cpp + qscriptdebuggercodefinderwidgetinterface_p.h + qscriptdebuggercodefinderwidgetinterface_p_p.h + qscriptdebuggercodefinderwidget_p.h + qscriptdebuggercodeview.cpp + qscriptdebuggercodeviewinterface.cpp + qscriptdebuggercodeviewinterface_p.h + qscriptdebuggercodeviewinterface_p_p.h + qscriptdebuggercodeview_p.h + qscriptdebuggercodewidget.cpp + qscriptdebuggercodewidgetinterface.cpp + qscriptdebuggercodewidgetinterface_p.h + qscriptdebuggercodewidgetinterface_p_p.h + qscriptdebuggercodewidget_p.h + qscriptdebuggercommand.cpp + qscriptdebuggercommandexecutor.cpp + qscriptdebuggercommandexecutor_p.h + qscriptdebuggercommand_p.h + qscriptdebuggercommandschedulerfrontend.cpp + qscriptdebuggercommandschedulerfrontend_p.h + qscriptdebuggercommandschedulerinterface_p.h + qscriptdebuggercommandschedulerjob.cpp + qscriptdebuggercommandschedulerjob_p.h + qscriptdebuggercommandschedulerjob_p_p.h + qscriptdebuggerconsolecommand.cpp + qscriptdebuggerconsolecommandgroupdata.cpp + qscriptdebuggerconsolecommandgroupdata_p.h + qscriptdebuggerconsolecommandjob.cpp + qscriptdebuggerconsolecommandjob_p.h + qscriptdebuggerconsolecommandjob_p_p.h + qscriptdebuggerconsolecommandmanager.cpp + qscriptdebuggerconsolecommandmanager_p.h + qscriptdebuggerconsolecommand_p.h + qscriptdebuggerconsolecommand_p_p.h + qscriptdebuggerconsole.cpp + qscriptdebuggerconsoleglobalobject.cpp + qscriptdebuggerconsoleglobalobject_p.h + qscriptdebuggerconsolehistorianinterface_p.h + qscriptdebuggerconsole_p.h + qscriptdebuggerconsolewidget.cpp + qscriptdebuggerconsolewidgetinterface.cpp + qscriptdebuggerconsolewidgetinterface_p.h + qscriptdebuggerconsolewidgetinterface_p_p.h + qscriptdebuggerconsolewidget_p.h + qscriptdebugger.cpp + qscriptdebuggerevent.cpp + qscriptdebuggereventhandlerinterface_p.h + qscriptdebuggerevent_p.h + qscriptdebuggerfrontend.cpp + qscriptdebuggerfrontend_p.h + qscriptdebuggerfrontend_p_p.h + qscriptdebuggerjob.cpp + qscriptdebuggerjob_p.h + qscriptdebuggerjob_p_p.h + qscriptdebuggerjobschedulerinterface_p.h + qscriptdebuggerlocalsmodel.cpp + qscriptdebuggerlocalsmodel_p.h + qscriptdebuggerlocalswidget.cpp + qscriptdebuggerlocalswidgetinterface.cpp + qscriptdebuggerlocalswidgetinterface_p.h + qscriptdebuggerlocalswidgetinterface_p_p.h + qscriptdebuggerlocalswidget_p.h + qscriptdebuggerobjectsnapshotdelta_p.h + qscriptdebugger_p.h + qscriptdebuggerresponse.cpp + qscriptdebuggerresponsehandlerinterface_p.h + qscriptdebuggerresponse_p.h + qscriptdebuggerscriptedconsolecommand.cpp + qscriptdebuggerscriptedconsolecommand_p.h + qscriptdebuggerscriptsmodel.cpp + qscriptdebuggerscriptsmodel_p.h + qscriptdebuggerscriptswidget.cpp + qscriptdebuggerscriptswidgetinterface.cpp + qscriptdebuggerscriptswidgetinterface_p.h + qscriptdebuggerscriptswidgetinterface_p_p.h + qscriptdebuggerscriptswidget_p.h + qscriptdebuggerstackmodel.cpp + qscriptdebuggerstackmodel_p.h + qscriptdebuggerstackwidget.cpp + qscriptdebuggerstackwidgetinterface.cpp + qscriptdebuggerstackwidgetinterface_p.h + qscriptdebuggerstackwidgetinterface_p_p.h + qscriptdebuggerstackwidget_p.h + qscriptdebuggerstandardwidgetfactory.cpp + qscriptdebuggerstandardwidgetfactory_p.h + qscriptdebuggervalue.cpp + qscriptdebuggervalue_p.h + qscriptdebuggervalueproperty.cpp + qscriptdebuggervalueproperty_p.h + qscriptdebuggerwidgetfactoryinterface_p.h + qscriptdebugoutputwidget.cpp + qscriptdebugoutputwidgetinterface.cpp + qscriptdebugoutputwidgetinterface_p.h + qscriptdebugoutputwidgetinterface_p_p.h + qscriptdebugoutputwidget_p.h + qscriptedit.cpp + qscriptedit_p.h + qscriptenginedebugger.cpp + qscriptenginedebuggerfrontend.cpp + qscriptenginedebuggerfrontend_p.h + qscriptenginedebugger.h + qscripterrorlogwidget.cpp + qscripterrorlogwidgetinterface.cpp + qscripterrorlogwidgetinterface_p.h + qscripterrorlogwidgetinterface_p_p.h + qscripterrorlogwidget_p.h + qscriptmessagehandlerinterface_p.h + qscriptobjectsnapshot.cpp + qscriptobjectsnapshot_p.h + qscriptscriptdata.cpp + qscriptscriptdata_p.h + qscriptstdmessagehandler.cpp + qscriptstdmessagehandler_p.h + qscriptsyntaxhighlighter.cpp + qscriptsyntaxhighlighter_p.h + qscripttooltipproviderinterface_p.h + qscriptvalueproperty.cpp + qscriptvalueproperty_p.h + qscriptxmlparser.cpp + qscriptxmlparser_p.h + scripts/ +0 commands/ +0 advance.qs + backtrace.qs + break.qs + clear.qs + complete.qs + condition.qs + continue.qs + delete.qs + disable.qs + down.qs + enable.qs + eval.qs + finish.qs + frame.qs + help.qs + ignore.qs + info.qs + interrupt.qs + list.qs + next.qs + print.qs + return.qs + step.qs + tbreak.qs + up.qs +3 scripttools_debugging.qrc +2 scripttools.pro +2 script/utils/ +0 qscriptdate.cpp + qscriptdate_p.h + utils.pri +2 sql/ +0 drivers/ +0 db2/ +0 qsql_db2.cpp + qsql_db2.h +2 drivers.pri + ibase/ +0 qsql_ibase.cpp + qsql_ibase.h +2 mysql/ +0 qsql_mysql.cpp + qsql_mysql.h +2 oci/ +0 qsql_oci.cpp + qsql_oci.h +2 odbc/ +0 qsql_odbc.cpp + qsql_odbc.h +2 psql/ +0 qsql_psql.cpp + qsql_psql.h +2 sqlite/ + sqlite2/ +0 qsql_sqlite2.cpp + qsql_sqlite2.h +2 sqlite/qsql_sqlite.cpp + sqlite/qsql_sqlite.h + tds/ +0 qsql_tds.cpp + qsql_tds.h +3 kernel/ +0 kernel.pri + qsqlcachedresult.cpp + qsqlcachedresult_p.h + qsqldatabase.cpp + qsqldatabase.h + qsqldriver.cpp + qsqldriver.h + qsqldriverplugin.cpp + qsqldriverplugin.h + qsqlerror.cpp + qsqlerror.h + qsqlfield.cpp + qsqlfield.h + qsql.h + qsqlindex.cpp + qsqlindex.h + qsqlnulldriver_p.h + qsql.qdoc + qsqlquery.cpp + qsqlquery.h + qsqlrecord.cpp + qsqlrecord.h + qsqlresult.cpp + qsqlresult.h +2 models/ +0 models.pri + qsqlquerymodel.cpp + qsqlquerymodel.h + qsqlquerymodel_p.h + qsqlrelationaldelegate.cpp + qsqlrelationaldelegate.h + qsqlrelationaltablemodel.cpp + qsqlrelationaltablemodel.h + qsqltablemodel.cpp + qsqltablemodel.h + qsqltablemodel_p.h +2 README.module + sql.pro +2 src.pro + svg/ +0 qgraphicssvgitem.cpp + qgraphicssvgitem.h + qsvgfont.cpp + qsvgfont_p.h + qsvggenerator.cpp + qsvggenerator.h + qsvggraphics.cpp + qsvggraphics_p.h + qsvghandler.cpp + qsvghandler_p.h + qsvgnode.cpp + qsvgnode_p.h + qsvgrenderer.cpp + qsvgrenderer.h + qsvgstructure.cpp + qsvgstructure_p.h + qsvgstyle.cpp + qsvgstyle_p.h + qsvgtinydocument.cpp + qsvgtinydocument_p.h + qsvgwidget.cpp + qsvgwidget.h + svg.pro +2 testlib/ +0 3rdparty/ +0 callgrind_p.h + cycle_p.h + valgrind_p.h +2 qabstracttestlogger.cpp + qabstracttestlogger_p.h + qasciikey.cpp + qbenchmark.cpp + qbenchmarkevent.cpp + qbenchmarkevent_p.h + qbenchmark.h + qbenchmarkmeasurement.cpp + qbenchmarkmeasurement_p.h + qbenchmark_p.h + qbenchmarkvalgrind.cpp + qbenchmarkvalgrind_p.h + qplaintestlogger.cpp + qplaintestlogger_p.h + qsignaldumper.cpp + qsignaldumper_p.h + qsignalspy.h + qsignalspy.qdoc + qtestaccessible.h + qtestassert.h + qtestbasicstreamer.cpp + qtestbasicstreamer.h + qtestcase.cpp + qtestcase.h + qtestcoreelement.h + qtestcorelist.h + qtestdata.cpp + qtestdata.h + qtestelementattribute.cpp + qtestelementattribute.h + qtestelement.cpp + qtestelement.h + qtestevent.h + qtesteventloop.h + qtestevent.qdoc + qtestfilelogger.cpp + qtestfilelogger.h + qtest_global.h + qtest_gui.h + qtest.h + qtestkeyboard.h + qtestlightxmlstreamer.cpp + qtestlightxmlstreamer.h + qtestlog.cpp + qtestlogger.cpp + qtestlogger_p.h + qtestlog_p.h + qtestmouse.h + qtestresult.cpp + qtestresult_p.h + qtestspontaneevent.h + qtestsystem.h + qtesttable.cpp + qtesttable_p.h + qtesttouch.h + qtestxmlstreamer.cpp + qtestxmlstreamer.h + qtestxunitstreamer.cpp + qtestxunitstreamer.h + qxmltestlogger.cpp + qxmltestlogger_p.h + testlib.pro +2 tools/ +0 bootstrap/ +0 bootstrap.pri + bootstrap.pro +2 idc/ +0 idc.pro + main.cpp +2 moc/ +0 generator.cpp + generator.h + keywords.cpp + main.cpp + moc.cpp + moc.h + moc.pri + moc.pro + mwerks_mac.cpp + mwerks_mac.h + outputrevision.h + parser.cpp + parser.h + ppkeywords.cpp + preprocessor.cpp + preprocessor.h + symbols.h + token.cpp + token.h + util/ +0 generate_keywords.cpp + generate_keywords.pro + generate.sh + licenseheader.txt +2 utils.h +2 rcc/ +0 main.cpp + rcc.cpp + rcc.h + rcc.pri + rcc.pro +2 tools.pro + uic/ + uic3/ +0 converter.cpp + deps.cpp + domtool.cpp + domtool.h + embed.cpp + form.cpp + main.cpp + object.cpp + parser.cpp + parser.h + qt3to4.cpp + qt3to4.h + subclassing.cpp + ui3reader.cpp + ui3reader.h + uic3.pro + uic.cpp + uic.h + widgetinfo.cpp + widgetinfo.h +2 uic/cpp/ +0 cppextractimages.cpp + cppextractimages.h + cpp.pri + cppwritedeclaration.cpp + cppwritedeclaration.h + cppwriteicondata.cpp + cppwriteicondata.h + cppwriteicondeclaration.cpp + cppwriteicondeclaration.h + cppwriteiconinitialization.cpp + cppwriteiconinitialization.h + cppwriteincludes.cpp + cppwriteincludes.h + cppwriteinitialization.cpp + cppwriteinitialization.h +2 uic/customwidgetsinfo.cpp + uic/customwidgetsinfo.h + uic/databaseinfo.cpp + uic/databaseinfo.h + uic/driver.cpp + uic/driver.h + uic/globaldefs.h + uic/main.cpp + uic/option.h + uic/treewalker.cpp + uic/treewalker.h + uic/ui4.cpp + uic/ui4.h + uic/uic.cpp + uic/uic.h + uic/uic.pri + uic/uic.pro + uic/utils.h + uic/validator.cpp + uic/validator.h +2 winmain/ +0 qtmain_win.cpp + winmain.pro +2 xml/ +0 dom/ +0 dom.pri + qdom.cpp + qdom.h +3 xmlpatterns/ +0 acceltree/ +0 acceltree.pri + qacceliterators.cpp + qacceliterators_p.h + qacceltreebuilder.cpp + qacceltreebuilder_p.h + qacceltree.cpp + qacceltree_p.h + qacceltreeresourceloader.cpp + qacceltreeresourceloader_p.h + qcompressedwhitespace.cpp + qcompressedwhitespace_p.h +2 api/ +0 api.pri + qabstractmessagehandler.cpp + qabstractmessagehandler.h + qabstracturiresolver.cpp + qabstracturiresolver.h + qabstractxmlforwarditerator.cpp + qabstractxmlforwarditerator_p.h + qabstractxmlnodemodel.cpp + qabstractxmlnodemodel.h + qabstractxmlnodemodel_p.h + qabstractxmlpullprovider.cpp + qabstractxmlpullprovider_p.h + qabstractxmlreceiver.cpp + qabstractxmlreceiver.h + qabstractxmlreceiver_p.h + qdeviceresourceloader_p.h + qiodevicedelegate.cpp + qiodevicedelegate_p.h + qnetworkaccessdelegator.cpp + qnetworkaccessdelegator_p.h + qpullbridge.cpp + qpullbridge_p.h + qreferencecountedvalue_p.h + qresourcedelegator.cpp + qresourcedelegator_p.h + qsimplexmlnodemodel.cpp + qsimplexmlnodemodel.h + qsourcelocation.cpp + qsourcelocation.h + quriloader.cpp + quriloader_p.h + qvariableloader.cpp + qvariableloader_p.h + qxmlformatter.cpp + qxmlformatter.h + qxmlname.cpp + qxmlname.h + qxmlnamepool.cpp + qxmlnamepool.h + qxmlquery.cpp + qxmlquery.h + qxmlquery_p.h + qxmlresultitems.cpp + qxmlresultitems.h + qxmlresultitems_p.h + qxmlschema.cpp + qxmlschema.h + qxmlschema_p.cpp + qxmlschema_p.h + qxmlschemavalidator.cpp + qxmlschemavalidator.h + qxmlschemavalidator_p.h + qxmlserializer.cpp + qxmlserializer.h + qxmlserializer_p.h +2 common.pri + data/ +0 data.pri + qabstractdatetime.cpp + qabstractdatetime_p.h + qabstractduration.cpp + qabstractduration_p.h + qabstractfloatcasters.cpp + qabstractfloatcasters_p.h + qabstractfloat.cpp + qabstractfloatmathematician.cpp + qabstractfloatmathematician_p.h + qabstractfloat_p.h + qanyuri.cpp + qanyuri_p.h + qatomiccaster.cpp + qatomiccaster_p.h + qatomiccasters.cpp + qatomiccasters_p.h + qatomiccomparator.cpp + qatomiccomparator_p.h + qatomiccomparators.cpp + qatomiccomparators_p.h + qatomicmathematician.cpp + qatomicmathematician_p.h + qatomicmathematicians.cpp + qatomicmathematicians_p.h + qatomicstring.cpp + qatomicstring_p.h + qatomicvalue.cpp + qbase64binary.cpp + qbase64binary_p.h + qboolean.cpp + qboolean_p.h + qcommonvalues.cpp + qcommonvalues_p.h + qcomparisonfactory.cpp + qcomparisonfactory_p.h + qdate.cpp + qdate_p.h + qdaytimeduration.cpp + qdaytimeduration_p.h + qdecimal.cpp + qdecimal_p.h + qderivedinteger_p.h + qderivedstring_p.h + qduration.cpp + qduration_p.h + qgday.cpp + qgday_p.h + qgmonth.cpp + qgmonthday.cpp + qgmonthday_p.h + qgmonth_p.h + qgyear.cpp + qgyearmonth.cpp + qgyearmonth_p.h + qgyear_p.h + qhexbinary.cpp + qhexbinary_p.h + qinteger.cpp + qinteger_p.h + qitem.cpp + qitem_p.h + qnodebuilder.cpp + qnodebuilder_p.h + qnodemodel.cpp + qqnamevalue.cpp + qqnamevalue_p.h + qresourceloader.cpp + qresourceloader_p.h + qschemadatetime.cpp + qschemadatetime_p.h + qschemanumeric.cpp + qschemanumeric_p.h + qschematime.cpp + qschematime_p.h + qsequencereceiver.cpp + qsequencereceiver_p.h + qsorttuple.cpp + qsorttuple_p.h + quntypedatomic.cpp + quntypedatomic_p.h + qvalidationerror.cpp + qvalidationerror_p.h + qvaluefactory.cpp + qvaluefactory_p.h + qyearmonthduration.cpp + qyearmonthduration_p.h +2 documentationGroups.dox + Doxyfile + environment/ +0 createReportContext.sh + createReportContext.xsl + environment.pri + qcurrentitemcontext.cpp + qcurrentitemcontext_p.h + qdelegatingdynamiccontext.cpp + qdelegatingdynamiccontext_p.h + qdelegatingstaticcontext.cpp + qdelegatingstaticcontext_p.h + qdynamiccontext.cpp + qdynamiccontext_p.h + qfocus.cpp + qfocus_p.h + qgenericdynamiccontext.cpp + qgenericdynamiccontext_p.h + qgenericstaticcontext.cpp + qgenericstaticcontext_p.h + qreceiverdynamiccontext.cpp + qreceiverdynamiccontext_p.h + qreportcontext.cpp + qreportcontext_p.h + qstackcontextbase.cpp + qstackcontextbase_p.h + qstaticbaseuricontext.cpp + qstaticbaseuricontext_p.h + qstaticcompatibilitycontext.cpp + qstaticcompatibilitycontext_p.h + qstaticcontext.cpp + qstaticcontext_p.h + qstaticcurrentcontext.cpp + qstaticcurrentcontext_p.h + qstaticfocuscontext.cpp + qstaticfocuscontext_p.h + qstaticnamespacecontext.cpp + qstaticnamespacecontext_p.h +2 expr/ +0 expr.pri + qandexpression.cpp + qandexpression_p.h + qapplytemplate.cpp + qapplytemplate_p.h + qargumentreference.cpp + qargumentreference_p.h + qarithmeticexpression.cpp + qarithmeticexpression_p.h + qattributeconstructor.cpp + qattributeconstructor_p.h + qattributenamevalidator.cpp + qattributenamevalidator_p.h + qaxisstep.cpp + qaxisstep_p.h + qcachecells_p.h + qcallsite.cpp + qcallsite_p.h + qcalltargetdescription.cpp + qcalltargetdescription_p.h + qcalltemplate.cpp + qcalltemplate_p.h + qcastableas.cpp + qcastableas_p.h + qcastas.cpp + qcastas_p.h + qcastingplatform.cpp + qcastingplatform_p.h + qcollationchecker.cpp + qcollationchecker_p.h + qcombinenodes.cpp + qcombinenodes_p.h + qcommentconstructor.cpp + qcommentconstructor_p.h + qcomparisonplatform.cpp + qcomparisonplatform_p.h + qcomputednamespaceconstructor.cpp + qcomputednamespaceconstructor_p.h + qcontextitem.cpp + qcontextitem_p.h + qcopyof.cpp + qcopyof_p.h + qcurrentitemstore.cpp + qcurrentitemstore_p.h + qdocumentconstructor.cpp + qdocumentconstructor_p.h + qdocumentcontentvalidator.cpp + qdocumentcontentvalidator_p.h + qdynamiccontextstore.cpp + qdynamiccontextstore_p.h + qelementconstructor.cpp + qelementconstructor_p.h + qemptycontainer.cpp + qemptycontainer_p.h + qemptysequence.cpp + qemptysequence_p.h + qevaluationcache.cpp + qevaluationcache_p.h + qexpression.cpp + qexpressiondispatch_p.h + qexpressionfactory.cpp + qexpressionfactory_p.h + qexpression_p.h + qexpressionsequence.cpp + qexpressionsequence_p.h + qexpressionvariablereference.cpp + qexpressionvariablereference_p.h + qexternalvariableloader.cpp + qexternalvariableloader_p.h + qexternalvariablereference.cpp + qexternalvariablereference_p.h + qfirstitempredicate.cpp + qfirstitempredicate_p.h + qforclause.cpp + qforclause_p.h + qgeneralcomparison.cpp + qgeneralcomparison_p.h + qgenericpredicate.cpp + qgenericpredicate_p.h + qifthenclause.cpp + qifthenclause_p.h + qinstanceof.cpp + qinstanceof_p.h + qletclause.cpp + qletclause_p.h + qliteral.cpp + qliteral_p.h + qliteralsequence.cpp + qliteralsequence_p.h + qnamespaceconstructor.cpp + qnamespaceconstructor_p.h + qncnameconstructor.cpp + qncnameconstructor_p.h + qnodecomparison.cpp + qnodecomparison_p.h + qnodesort.cpp + qnodesort_p.h + qoperandsiterator_p.h + qoptimizationpasses.cpp + qoptimizationpasses_p.h + qoptimizerblocks.cpp + qoptimizerblocks_p.h + qoptimizerframework.cpp + qoptimizerframework_p.h + qorderby.cpp + qorderby_p.h + qorexpression.cpp + qorexpression_p.h + qpaircontainer.cpp + qpaircontainer_p.h + qparentnodeaxis.cpp + qparentnodeaxis_p.h + qpath.cpp + qpath_p.h + qpositionalvariablereference.cpp + qpositionalvariablereference_p.h + qprocessinginstructionconstructor.cpp + qprocessinginstructionconstructor_p.h + qqnameconstructor.cpp + qqnameconstructor_p.h + qquantifiedexpression.cpp + qquantifiedexpression_p.h + qrangeexpression.cpp + qrangeexpression_p.h + qrangevariablereference.cpp + qrangevariablereference_p.h + qreturnorderby.cpp + qreturnorderby_p.h + qsimplecontentconstructor.cpp + qsimplecontentconstructor_p.h + qsinglecontainer.cpp + qsinglecontainer_p.h + qsourcelocationreflection.cpp + qsourcelocationreflection_p.h + qstaticbaseuristore.cpp + qstaticbaseuristore_p.h + qstaticcompatibilitystore.cpp + qstaticcompatibilitystore_p.h + qtemplate.cpp + qtemplateinvoker.cpp + qtemplateinvoker_p.h + qtemplatemode.cpp + qtemplatemode_p.h + qtemplateparameterreference.cpp + qtemplateparameterreference_p.h + qtemplatepattern_p.h + qtemplate_p.h + qtextnodeconstructor.cpp + qtextnodeconstructor_p.h + qtreatas.cpp + qtreatas_p.h + qtriplecontainer.cpp + qtriplecontainer_p.h + qtruthpredicate.cpp + qtruthpredicate_p.h + qunaryexpression.cpp + qunaryexpression_p.h + qunlimitedcontainer.cpp + qunlimitedcontainer_p.h + qunresolvedvariablereference.cpp + qunresolvedvariablereference_p.h + quserfunctioncallsite.cpp + quserfunctioncallsite_p.h + quserfunction.cpp + quserfunction_p.h + qvalidate.cpp + qvalidate_p.h + qvaluecomparison.cpp + qvaluecomparison_p.h + qvariabledeclaration.cpp + qvariabledeclaration_p.h + qvariablereference.cpp + qvariablereference_p.h + qwithparam_p.h + qxsltsimplecontentconstructor.cpp + qxsltsimplecontentconstructor_p.h +2 functions/ +0 functions.pri + qabstractfunctionfactory.cpp + qabstractfunctionfactory_p.h + qaccessorfns.cpp + qaccessorfns_p.h + qaggregatefns.cpp + qaggregatefns_p.h + qaggregator.cpp + qaggregator_p.h + qassemblestringfns.cpp + qassemblestringfns_p.h + qbooleanfns.cpp + qbooleanfns_p.h + qcomparescaseaware.cpp + qcomparescaseaware_p.h + qcomparestringfns.cpp + qcomparestringfns_p.h + qcomparingaggregator.cpp + qcomparingaggregator_p.h + qconstructorfunctionsfactory.cpp + qconstructorfunctionsfactory_p.h + qcontextfns.cpp + qcontextfns_p.h + qcontextnodechecker.cpp + qcontextnodechecker_p.h + qcurrentfn.cpp + qcurrentfn_p.h + qdatetimefn.cpp + qdatetimefn_p.h + qdatetimefns.cpp + qdatetimefns_p.h + qdeepequalfn.cpp + qdeepequalfn_p.h + qdocumentfn.cpp + qdocumentfn_p.h + qelementavailablefn.cpp + qelementavailablefn_p.h + qerrorfn.cpp + qerrorfn_p.h + qfunctionargument.cpp + qfunctionargument_p.h + qfunctionavailablefn.cpp + qfunctionavailablefn_p.h + qfunctioncall.cpp + qfunctioncall_p.h + qfunctionfactorycollection.cpp + qfunctionfactorycollection_p.h + qfunctionfactory.cpp + qfunctionfactory_p.h + qfunctionsignature.cpp + qfunctionsignature_p.h + qgenerateidfn.cpp + qgenerateidfn_p.h + qnodefns.cpp + qnodefns_p.h + qnumericfns.cpp + qnumericfns_p.h + qpatternmatchingfns.cpp + qpatternmatchingfns_p.h + qpatternplatform.cpp + qpatternplatform_p.h + qqnamefns.cpp + qqnamefns_p.h + qresolveurifn.cpp + qresolveurifn_p.h + qsequencefns.cpp + qsequencefns_p.h + qsequencegeneratingfns.cpp + qsequencegeneratingfns_p.h + qstaticbaseuricontainer_p.h + qstaticnamespacescontainer.cpp + qstaticnamespacescontainer_p.h + qstringvaluefns.cpp + qstringvaluefns_p.h + qsubstringfns.cpp + qsubstringfns_p.h + qsystempropertyfn.cpp + qsystempropertyfn_p.h + qtimezonefns.cpp + qtimezonefns_p.h + qtracefn.cpp + qtracefn_p.h + qtypeavailablefn.cpp + qtypeavailablefn_p.h + qunparsedentitypublicidfn.cpp + qunparsedentitypublicidfn_p.h + qunparsedentityurifn.cpp + qunparsedentityurifn_p.h + qunparsedtextavailablefn.cpp + qunparsedtextavailablefn_p.h + qunparsedtextfn.cpp + qunparsedtextfn_p.h + qxpath10corefunctions.cpp + qxpath10corefunctions_p.h + qxpath20corefunctions.cpp + qxpath20corefunctions_p.h + qxslt20corefunctions.cpp + qxslt20corefunctions_p.h +2 .gitignore + iterators/ +0 iterators.pri + qcachingiterator.cpp + qcachingiterator_p.h + qdeduplicateiterator.cpp + qdeduplicateiterator_p.h + qdistinctiterator.cpp + qdistinctiterator_p.h + qemptyiterator_p.h + qexceptiterator.cpp + qexceptiterator_p.h + qindexofiterator.cpp + qindexofiterator_p.h + qinsertioniterator.cpp + qinsertioniterator_p.h + qintersectiterator.cpp + qintersectiterator_p.h + qitemmappingiterator_p.h + qrangeiterator.cpp + qrangeiterator_p.h + qremovaliterator.cpp + qremovaliterator_p.h + qsequencemappingiterator_p.h + qsingletoniterator_p.h + qsubsequenceiterator.cpp + qsubsequenceiterator_p.h + qtocodepointsiterator.cpp + qtocodepointsiterator_p.h + qunioniterator.cpp + qunioniterator_p.h +2 janitors/ +0 janitors.pri + qargumentconverter.cpp + qargumentconverter_p.h + qatomizer.cpp + qatomizer_p.h + qcardinalityverifier.cpp + qcardinalityverifier_p.h + qebvextractor.cpp + qebvextractor_p.h + qitemverifier.cpp + qitemverifier_p.h + quntypedatomicconverter.cpp + quntypedatomicconverter_p.h +2 Mainpage.dox + parser/ +0 createParser.sh + createTokenLookup.sh + createXSLTTokenLookup.sh + .gitattributes + .gitignore + parser.pri + qmaintainingreader.cpp + qmaintainingreader_p.h + qparsercontext.cpp + qparsercontext_p.h + qquerytransformparser.cpp + qquerytransformparser_p.h + qtokenizer_p.h + qtokenlookup.cpp + qtokenrevealer.cpp + qtokenrevealer_p.h + qtokensource.cpp + qtokensource_p.h + querytransformparser.ypp + qxquerytokenizer.cpp + qxquerytokenizer_p.h + qxslttokenizer.cpp + qxslttokenizer_p.h + qxslttokenlookup.cpp + qxslttokenlookup_p.h + qxslttokenlookup.xml + TokenLookup.gperf + trolltechHeader.txt + winCEWorkaround.sed +2 projection/ +0 projection.pri + qdocumentprojector.cpp + qdocumentprojector_p.h + qprojectedexpression_p.h +2 qtokenautomaton/ +0 exampleFile.xml + qautomaton2cpp.xsl + qtokenautomaton.xsd + README +2 query.pri + schema/ +0 builtinschemas.qrc + doc/ +0 All_diagram.dot + Alternative_diagram.dot + Annotation_diagram.dot + AnyAttribute_diagram.dot + Any_diagram.dot + Assert_diagram.dot + Choice_diagram.dot + ComplexContent_diagram.dot + ComplexContentExtension_diagram.dot + ComplexContentRestriction_diagram.dot + DefaultOpenContent_diagram.dot + EnumerationFacet_diagram.dot + Field_diagram.dot + FractionDigitsFacet_diagram.dot + GlobalAttribute_diagram.dot + GlobalComplexType_diagram.dot + GlobalElement_diagram.dot + GlobalSimpleType_diagram.dot + Import_diagram.dot + Include_diagram.dot + Key_diagram.dot + KeyRef_diagram.dot + legend.dot + LengthFacet_diagram.dot + List_diagram.dot + LocalAll_diagram.dot + LocalAttribute_diagram.dot + LocalChoice_diagram.dot + LocalComplexType_diagram.dot + LocalElement_diagram.dot + LocalSequence_diagram.dot + LocalSimpleType_diagram.dot + MaxExclusiveFacet_diagram.dot + MaxInclusiveFacet_diagram.dot + MaxLengthFacet_diagram.dot + MinExclusiveFacet_diagram.dot + MinInclusiveFacet_diagram.dot + MinLengthFacet_diagram.dot + NamedAttributeGroup_diagram.dot + NamedGroup_diagram.dot + Notation_diagram.dot + Override_diagram.dot + PatternFacet_diagram.dot + Redefine_diagram.dot + ReferredAttributeGroup_diagram.dot + ReferredGroup_diagram.dot + Schema_diagram.dot + Selector_diagram.dot + Sequence_diagram.dot + SimpleContent_diagram.dot + SimpleContentExtension_diagram.dot + SimpleContentRestriction_diagram.dot + SimpleRestriction_diagram.dot + TotalDigitsFacet_diagram.dot + Union_diagram.dot + Unique_diagram.dot + WhiteSpaceFacet_diagram.dot +2 .gitignore + qnamespacesupport.cpp + qnamespacesupport_p.h + qxsdalternative.cpp + qxsdalternative_p.h + qxsdannotated.cpp + qxsdannotated_p.h + qxsdannotation.cpp + qxsdannotation_p.h + qxsdapplicationinformation.cpp + qxsdapplicationinformation_p.h + qxsdassertion.cpp + qxsdassertion_p.h + qxsdattribute.cpp + qxsdattributegroup.cpp + qxsdattributegroup_p.h + qxsdattribute_p.h + qxsdattributereference.cpp + qxsdattributereference_p.h + qxsdattributeterm.cpp + qxsdattributeterm_p.h + qxsdattributeuse.cpp + qxsdattributeuse_p.h + qxsdcomplextype.cpp + qxsdcomplextype_p.h + qxsddocumentation.cpp + qxsddocumentation_p.h + qxsdelement.cpp + qxsdelement_p.h + qxsdfacet.cpp + qxsdfacet_p.h + qxsdidcache.cpp + qxsdidcache_p.h + qxsdidchelper.cpp + qxsdidchelper_p.h + qxsdidentityconstraint.cpp + qxsdidentityconstraint_p.h + qxsdinstancereader.cpp + qxsdinstancereader_p.h + qxsdmodelgroup.cpp + qxsdmodelgroup_p.h + qxsdnotation.cpp + qxsdnotation_p.h + qxsdparticlechecker.cpp + qxsdparticlechecker_p.h + qxsdparticle.cpp + qxsdparticle_p.h + qxsdreference.cpp + qxsdreference_p.h + qxsdschemachecker.cpp + qxsdschemachecker_helper.cpp + qxsdschemachecker_p.h + qxsdschemachecker_setup.cpp + qxsdschemacontext.cpp + qxsdschemacontext_p.h + qxsdschema.cpp + qxsdschemadebugger.cpp + qxsdschemadebugger_p.h + qxsdschemahelper.cpp + qxsdschemahelper_p.h + qxsdschemamerger.cpp + qxsdschemamerger_p.h + qxsdschemaparsercontext.cpp + qxsdschemaparsercontext_p.h + qxsdschemaparser.cpp + qxsdschemaparser_p.h + qxsdschemaparser_setup.cpp + qxsdschema_p.h + qxsdschemaresolver.cpp + qxsdschemaresolver_p.h + qxsdschematoken.cpp + qxsdschematoken_p.h + qxsdschematypesfactory.cpp + qxsdschematypesfactory_p.h + qxsdsimpletype.cpp + qxsdsimpletype_p.h + qxsdstatemachinebuilder.cpp + qxsdstatemachinebuilder_p.h + qxsdstatemachine.cpp + qxsdstatemachine_p.h + qxsdterm.cpp + qxsdterm_p.h + qxsdtypechecker.cpp + qxsdtypechecker_p.h + qxsduserschematype.cpp + qxsduserschematype_p.h + qxsdvalidatedxmlnodemodel.cpp + qxsdvalidatedxmlnodemodel_p.h + qxsdvalidatinginstancereader.cpp + qxsdvalidatinginstancereader_p.h + qxsdwildcard.cpp + qxsdwildcard_p.h + qxsdxpathexpression.cpp + qxsdxpathexpression_p.h + schema.pri + schemas/ +0 xml.xsd +0 -LICENSE +3 tokens.xml +2 type/ +0 qabstractnodetest.cpp + qabstractnodetest_p.h + qanyitemtype.cpp + qanyitemtype_p.h + qanynodetype.cpp + qanynodetype_p.h + qanysimpletype.cpp + qanysimpletype_p.h + qanytype.cpp + qanytype_p.h + qatomiccasterlocator.cpp + qatomiccasterlocator_p.h + qatomiccasterlocators.cpp + qatomiccasterlocators_p.h + qatomiccomparatorlocator.cpp + qatomiccomparatorlocator_p.h + qatomiccomparatorlocators.cpp + qatomiccomparatorlocators_p.h + qatomicmathematicianlocator.cpp + qatomicmathematicianlocator_p.h + qatomicmathematicianlocators.cpp + qatomicmathematicianlocators_p.h + qatomictype.cpp + qatomictypedispatch_p.h + qatomictype_p.h + qbasictypesfactory.cpp + qbasictypesfactory_p.h + qbuiltinatomictype.cpp + qbuiltinatomictype_p.h + qbuiltinatomictypes.cpp + qbuiltinatomictypes_p.h + qbuiltinnodetype.cpp + qbuiltinnodetype_p.h + qbuiltintypes.cpp + qbuiltintypes_p.h + qcardinality.cpp + qcardinality_p.h + qcommonsequencetypes.cpp + qcommonsequencetypes_p.h + qebvtype.cpp + qebvtype_p.h + qemptysequencetype.cpp + qemptysequencetype_p.h + qgenericsequencetype.cpp + qgenericsequencetype_p.h + qitemtype.cpp + qitemtype_p.h + qlocalnametest.cpp + qlocalnametest_p.h + qmultiitemtype.cpp + qmultiitemtype_p.h + qnamedschemacomponent.cpp + qnamedschemacomponent_p.h + qnamespacenametest.cpp + qnamespacenametest_p.h + qnonetype.cpp + qnonetype_p.h + qnumerictype.cpp + qnumerictype_p.h + qprimitives_p.h + qqnametest.cpp + qqnametest_p.h + qschemacomponent.cpp + qschemacomponent_p.h + qschematype.cpp + qschematypefactory.cpp + qschematypefactory_p.h + qschematype_p.h + qsequencetype.cpp + qsequencetype_p.h + qtypechecker.cpp + qtypechecker_p.h + quntyped.cpp + quntyped_p.h + qxsltnodetest.cpp + qxsltnodetest_p.h + type.pri +2 utils/ +0 qautoptr.cpp + qautoptr_p.h + qcommonnamespaces_p.h + qcppcastinghelper_p.h + qdebug_p.h + qdelegatingnamespaceresolver.cpp + qdelegatingnamespaceresolver_p.h + qgenericnamespaceresolver.cpp + qgenericnamespaceresolver_p.h + qnamepool.cpp + qnamepool_p.h + qnamespacebinding_p.h + qnamespaceresolver.cpp + qnamespaceresolver_p.h + qnodenamespaceresolver.cpp + qnodenamespaceresolver_p.h + qoutputvalidator.cpp + qoutputvalidator_p.h + qpatternistlocale.cpp + qpatternistlocale_p.h + qxpathhelper.cpp + qxpathhelper_p.h + utils.pri +2 xmlpatterns.pro +2 xml/sax/ +0 qxml.cpp + qxml.h + sax.pri +2 xml/stream/ +0 qxmlstream.h + stream.pri +2 xml/xml.pro diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp new file mode 100644 index 0000000..ad5ae98 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.cpp @@ -0,0 +1,173 @@ +/**************************************************************************** +** +** 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 module 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 <QtTest/QTest> + +#include <QDirIterator> +#include <QFile> +#include <QString> +#include <QStack> + +#include "../../../../../shared/filesystem.h" + +class bench_QDir_tree + : public QObject +{ + Q_OBJECT + +public: + bench_QDir_tree() + : prefix("./test-tree/") + { + } + +private: + QByteArray prefix; + +private slots: + void initTestCase() + { + QFile list(":/4.6.0-list.txt"); + QVERIFY(list.open(QIODevice::ReadOnly | QIODevice::Text)); + + QVERIFY(fs.createDirectory(prefix)); + + QStack<QByteArray> stack; + QByteArray line; + Q_FOREVER { + char ch; + if (!list.getChar(&ch)) + break; + if (ch != ' ') { + line.append(ch); + continue; + } + + int pop = 1; + if (!line.isEmpty()) + pop = line.toInt(); + + while (pop) { + stack.pop(); + --pop; + } + + line = list.readLine(); + line.chop(1); + stack.push(line); + + line = prefix; + Q_FOREACH(const QByteArray &pathElement, stack) + line += pathElement; + + if (line.endsWith('/')) + QVERIFY(fs.createDirectory(line)); + else + QVERIFY(fs.createFile(line)); + + line.clear(); + } + } + + void fileSearch_data() const + { + QTest::addColumn<QStringList>("nameFilters"); + QTest::addColumn<int>("filter"); + QTest::addColumn<int>("entryCount"); + + QTest::newRow("*.cpp") << QStringList("*.cpp") + << int(QDir::Files) + << 3813; + + QTest::newRow("executables") << QStringList("*") + << int(QDir::Executable | QDir::Files | QDir::AllDirs | QDir::NoDotAndDotDot) + << 543; + } + + void fileSearch() const + { + QFETCH(QStringList, nameFilters); + QFETCH(int, filter); + QFETCH(int, entryCount); + + int count = 0; + QBENCHMARK { + // Recursive directory iteration + QDirIterator iterator(prefix, nameFilters, QDir::Filter(filter), + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + + count = 0; + while (iterator.hasNext()) { + iterator.next(); + ++count; + } + + QCOMPARE(count, entryCount); + } + + QCOMPARE(count, entryCount); + } + + void traverseDirectory() const + { + int count = 0; + QBENCHMARK { + QDirIterator iterator(prefix, + QDir::AllEntries | QDir::NoDotAndDotDot | QDir::Hidden | QDir::System, + QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); + + while (iterator.hasNext()) { + iterator.next(); + ++count; + } + + QCOMPARE(count, 11963); + } + + QCOMPARE(count, 11963); + } + +private: + FileSystem fs; +}; + +QTEST_MAIN(bench_QDir_tree) +#include "bench_qdir_tree.moc" diff --git a/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc new file mode 100644 index 0000000..d57cb6c --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/tree/bench_qdir_tree.qrc @@ -0,0 +1,5 @@ +<!DOCTYPE RCC><RCC version="1.0"> +<qresource> + <file>4.6.0-list.txt</file> +</qresource> +</RCC> diff --git a/tests/benchmarks/corelib/io/qdir/tree/tree.pro b/tests/benchmarks/corelib/io/qdir/tree/tree.pro new file mode 100644 index 0000000..773f0f7 --- /dev/null +++ b/tests/benchmarks/corelib/io/qdir/tree/tree.pro @@ -0,0 +1,11 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = bench_qdir_tree +DEPENDPATH += . +INCLUDEPATH += . + +# Input +SOURCES += bench_qdir_tree.cpp +RESOURCES += bench_qdir_tree.qrc + +QT -= gui diff --git a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro index 295cb50..eca619f 100644 --- a/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro +++ b/tests/benchmarks/corelib/io/qfileinfo/qfileinfo.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = qfileinfo +TARGET = tst_qfileinfo DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro index e25f186..aa4cc41 100644 --- a/tests/benchmarks/declarative/binding/binding.pro +++ b/tests/benchmarks/declarative/binding/binding.pro @@ -7,3 +7,9 @@ macx:CONFIG -= app_bundle SOURCES += tst_binding.cpp testtypes.cpp HEADERS += testtypes.h +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT = data +} + diff --git a/tests/benchmarks/declarative/binding/testtypes.cpp b/tests/benchmarks/declarative/binding/testtypes.cpp index 3a9f59b..043c8ab 100644 --- a/tests/benchmarks/declarative/binding/testtypes.cpp +++ b/tests/benchmarks/declarative/binding/testtypes.cpp @@ -40,4 +40,7 @@ ****************************************************************************/ #include "testtypes.h" -QML_DEFINE_TYPE(Test, 1, 0, MyQmlObject, MyQmlObject); +void registerTypes() +{ + QML_REGISTER_TYPE(Test, 1, 0, MyQmlObject, MyQmlObject); +} diff --git a/tests/benchmarks/declarative/binding/testtypes.h b/tests/benchmarks/declarative/binding/testtypes.h index d4e0a1a..4b103ce 100644 --- a/tests/benchmarks/declarative/binding/testtypes.h +++ b/tests/benchmarks/declarative/binding/testtypes.h @@ -42,7 +42,7 @@ #define TESTTYPES_H #include <QtCore/qobject.h> -#include <QtDeclarative/qml.h> +#include <QtDeclarative/qdeclarative.h> class MyQmlObject : public QObject { @@ -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(QmlList<QObject *> *data READ data); + Q_PROPERTY(QDeclarativeList<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(); } - QmlList<QObject *> *data() { return &m_data; } + QDeclarativeList<QObject *> *data() { return &m_data; } MyQmlObject *object() const { return m_object; } void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } @@ -71,11 +71,13 @@ signals: void objectChanged(); private: - QmlConcreteList<QObject *> m_data; + QDeclarativeConcreteList<QObject *> m_data; int m_result; int m_value; MyQmlObject *m_object; }; QML_DECLARE_TYPE(MyQmlObject); +void registerTypes(); + #endif // TESTTYPES_H diff --git a/tests/benchmarks/declarative/binding/tst_binding.cpp b/tests/benchmarks/declarative/binding/tst_binding.cpp index 74a3407..ee529a7 100644 --- a/tests/benchmarks/declarative/binding/tst_binding.cpp +++ b/tests/benchmarks/declarative/binding/tst_binding.cpp @@ -40,8 +40,8 @@ ****************************************************************************/ #include <qtest.h> -#include <QmlEngine> -#include <QmlComponent> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> #include <QFile> #include <QDebug> #include "testtypes.h" @@ -57,8 +57,8 @@ public: virtual ~tst_binding(); public slots: - void init(); - void cleanup(); + void initTestCase(); + void cleanupTestCase(); private slots: void objectproperty_data(); @@ -67,7 +67,7 @@ private slots: void basicproperty(); private: - QmlEngine engine; + QDeclarativeEngine engine; }; tst_binding::tst_binding() @@ -78,16 +78,17 @@ tst_binding::~tst_binding() { } -void tst_binding::init() +void tst_binding::initTestCase() { + registerTypes(); } -void tst_binding::cleanup() +void tst_binding::cleanupTestCase() { } #define COMPONENT(filename, binding) \ - QmlComponent c(&engine); \ + QDeclarativeComponent c(&engine); \ { \ QFile f(filename); \ QVERIFY(f.open(QIODevice::ReadOnly)); \ diff --git a/tests/benchmarks/declarative/creation/creation.pro b/tests/benchmarks/declarative/creation/creation.pro index fcc2987..3e0caf6 100644 --- a/tests/benchmarks/declarative/creation/creation.pro +++ b/tests/benchmarks/declarative/creation/creation.pro @@ -6,5 +6,10 @@ macx:CONFIG -= app_bundle SOURCES += tst_creation.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" - +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += addFiles +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +}
\ No newline at end of file diff --git a/tests/benchmarks/declarative/creation/tst_creation.cpp b/tests/benchmarks/declarative/creation/tst_creation.cpp index 23c820c..9c0fd27 100644 --- a/tests/benchmarks/declarative/creation/tst_creation.cpp +++ b/tests/benchmarks/declarative/creation/tst_creation.cpp @@ -40,15 +40,21 @@ ****************************************************************************/ #include <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QmlMetaType> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDeclarativeMetaType> #include <QDebug> #include <QGraphicsScene> #include <QGraphicsItem> -#include <QmlGraphicsItem> +#include <QDeclarativeItem> #include <private/qobject_p.h> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + class tst_creation : public QObject { Q_OBJECT @@ -77,7 +83,7 @@ private slots: void itemtree_scene_cpp(); private: - QmlEngine engine; + QDeclarativeEngine engine; }; inline QUrl TEST_FILE(const QString &filename) @@ -95,7 +101,7 @@ void tst_creation::qobject_cpp() void tst_creation::qobject_qml() { - QmlComponent component(&engine, TEST_FILE("qobject.qml")); + QDeclarativeComponent component(&engine, TEST_FILE("qobject.qml")); QObject *obj = component.create(); delete obj; @@ -107,7 +113,7 @@ void tst_creation::qobject_qml() void tst_creation::qobject_qmltype() { - QmlType *t = QmlMetaType::qmlType("Qt/QtObject", 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType("Qt/QtObject", 4, 6); QBENCHMARK { QObject *obj = t->create(); @@ -148,7 +154,7 @@ void tst_creation::objects_qmltype_data() { QTest::addColumn<QByteArray>("type"); - QList<QByteArray> types = QmlMetaType::qmlTypeNames(); + QList<QByteArray> types = QDeclarativeMetaType::qmlTypeNames(); foreach (QByteArray type, types) QTest::newRow(type.constData()) << type; } @@ -156,7 +162,7 @@ void tst_creation::objects_qmltype_data() void tst_creation::objects_qmltype() { QFETCH(QByteArray, type); - QmlType *t = QmlMetaType::qmlType(type, 4, 6); + QDeclarativeType *t = QDeclarativeMetaType::qmlType(type, 4, 6); QBENCHMARK { QObject *obj = t->create(); @@ -275,7 +281,7 @@ void tst_creation::qgraphicsitem_tree14() } } -struct QmlGraphics_DerivedObject : public QObject +struct QDeclarativeGraphics_DerivedObject : public QObject { void setParent_noEvent(QObject *parent) { bool sce = d_ptr->sendChildEvents; @@ -285,17 +291,17 @@ struct QmlGraphics_DerivedObject : public QObject } }; -inline void QmlGraphics_setParent_noEvent(QObject *object, QObject *parent) +inline void QDeclarativeGraphics_setParent_noEvent(QObject *object, QObject *parent) { - static_cast<QmlGraphics_DerivedObject *>(object)->setParent_noEvent(parent); + static_cast<QDeclarativeGraphics_DerivedObject *>(object)->setParent_noEvent(parent); } void tst_creation::itemtree_notree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; + QDeclarativeItem *child = new QDeclarativeItem; } delete item; } @@ -304,10 +310,10 @@ void tst_creation::itemtree_notree_cpp() void tst_creation::itemtree_objtree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); } delete item; } @@ -316,10 +322,10 @@ void tst_creation::itemtree_objtree_cpp() void tst_creation::itemtree_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); child->setParentItem(item); } delete item; @@ -329,10 +335,10 @@ void tst_creation::itemtree_cpp() void tst_creation::itemtree_data_cpp() { QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); item->data()->append(child); } delete item; @@ -341,7 +347,7 @@ void tst_creation::itemtree_data_cpp() void tst_creation::itemtree_qml() { - QmlComponent component(&engine, TEST_FILE("item.qml")); + QDeclarativeComponent component(&engine, TEST_FILE("item.qml")); QObject *obj = component.create(); delete obj; @@ -354,13 +360,13 @@ void tst_creation::itemtree_qml() void tst_creation::itemtree_scene_cpp() { QGraphicsScene scene; - QmlGraphicsItem *root = new QmlGraphicsItem; + QDeclarativeItem *root = new QDeclarativeItem; scene.addItem(root); QBENCHMARK { - QmlGraphicsItem *item = new QmlGraphicsItem; + QDeclarativeItem *item = new QDeclarativeItem; for (int i = 0; i < 30; ++i) { - QmlGraphicsItem *child = new QmlGraphicsItem; - QmlGraphics_setParent_noEvent(child,item); + QDeclarativeItem *child = new QDeclarativeItem; + QDeclarativeGraphics_setParent_noEvent(child,item); child->setParentItem(item); } item->setParentItem(root); diff --git a/tests/benchmarks/declarative/declarative.pro b/tests/benchmarks/declarative/declarative.pro index 8433de5..8c0ed42 100644 --- a/tests/benchmarks/declarative/declarative.pro +++ b/tests/benchmarks/declarative/declarative.pro @@ -3,8 +3,8 @@ SUBDIRS += \ binding \ creation \ pointers \ - qmlcomponent \ - qmlgraphicsimage \ - qmlmetaproperty \ + qdeclarativecomponent \ + qdeclarativeimage \ + qdeclarativemetaproperty \ script \ -# qmltime +# qdeclarativetime diff --git a/tests/benchmarks/declarative/pointers/tst_pointers.cpp b/tests/benchmarks/declarative/pointers/tst_pointers.cpp index 4fead9a..7257bee 100644 --- a/tests/benchmarks/declarative/pointers/tst_pointers.cpp +++ b/tests/benchmarks/declarative/pointers/tst_pointers.cpp @@ -40,7 +40,7 @@ ****************************************************************************/ #include <qtest.h> -#include "private/qmlguard_p.h" +#include "private/qdeclarativeguard_p.h" #include <QWeakPointer> class tst_pointers : public QObject @@ -59,7 +59,7 @@ void tst_pointers::qmlguard() { QObject *obj = new QObject; QBENCHMARK { - QmlGuard<QObject> guardedObject; + QDeclarativeGuard<QObject> guardedObject; guardedObject = obj; } } diff --git a/tests/benchmarks/declarative/qmlcomponent/data/myqmlobject.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject.qml index 9c3f7f8..9c3f7f8 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/myqmlobject.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/myqmlobject_binding.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject_binding.qml index e6cc4cf..e6cc4cf 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/myqmlobject_binding.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/myqmlobject_binding.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/object.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml index 0d2d49b..0d2d49b 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/object.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/object_id.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml index 69114af..69114af 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/object_id.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/object_id.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml index 723e62a..723e62a 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/BoomBlock.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/BoomBlock.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStar.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStar.png Binary files differindex ff9588f..ff9588f 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStar.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStar.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStone.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStone.png Binary files differindex bf342e0..bf342e0 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/blueStone.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/blueStone.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStar.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStar.png Binary files differindex cd06854..cd06854 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStar.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStar.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStone.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStone.png Binary files differindex 5ac14a5..5ac14a5 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/greenStone.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/greenStone.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStar.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStar.png Binary files differindex 0a4dffe..0a4dffe 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStar.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStar.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStone.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStone.png Binary files differindex b099f60..b099f60 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/redStone.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/redStone.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/yellowStone.png b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/yellowStone.png Binary files differindex c56124a..c56124a 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/samegame/pics/yellowStone.png +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/samegame/pics/yellowStone.png diff --git a/tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.2.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml index 27c5646..27c5646 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.2.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.2.qml diff --git a/tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.qml b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml index d08f35b..d08f35b 100644 --- a/tests/benchmarks/declarative/qmlcomponent/data/synthesized_properties.qml +++ b/tests/benchmarks/declarative/qdeclarativecomponent/data/synthesized_properties.qml diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro new file mode 100644 index 0000000..12fa9f4 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativecomponent/qdeclarativecomponent.pro @@ -0,0 +1,19 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qdeclarativecomponent +QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativecomponent.cpp testtypes.cpp +HEADERS += testtypes.h + +symbian* { + data.sources = data/* + data.path = data + samegame.sources = data/samegame/* + samegame.path = data/samegame + samegame_pics.sources = data/samegame/pics/* + samegame_pics.path = data/samegame/pics + DEPLOYMENT += data samegame samegame_pics +} + diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp new file mode 100644 index 0000000..acdc395 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.cpp @@ -0,0 +1,46 @@ +/**************************************************************************** +** +** 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 registerTypes() +{ + QML_REGISTER_TYPE(Qt.test, 4, 6, MyQmlObject, MyQmlObject); +} diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h new file mode 100644 index 0000000..4b103ce --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativecomponent/testtypes.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** 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$ +** +****************************************************************************/ +#ifndef TESTTYPES_H +#define TESTTYPES_H + +#include <QtCore/qobject.h> +#include <QtDeclarative/qdeclarative.h> + +class MyQmlObject : public QObject +{ + Q_OBJECT + 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_CLASSINFO("DefaultProperty", "data"); +public: + MyQmlObject() : m_result(0), m_value(0), m_object(0) {} + + int result() const { return m_result; } + void setResult(int r) { m_result = r; } + + int value() const { return m_value; } + void setValue(int v) { m_value = v; emit valueChanged(); } + + QDeclarativeList<QObject *> *data() { return &m_data; } + + MyQmlObject *object() const { return m_object; } + void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } + +signals: + void valueChanged(); + void objectChanged(); + +private: + QDeclarativeConcreteList<QObject *> m_data; + int m_result; + int m_value; + MyQmlObject *m_object; +}; +QML_DECLARE_TYPE(MyQmlObject); + +void registerTypes(); + +#endif // TESTTYPES_H diff --git a/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp new file mode 100644 index 0000000..7065303 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativecomponent/tst_qdeclarativecomponent.cpp @@ -0,0 +1,119 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QFile> +#include <QDebug> +#include "testtypes.h" + +//TESTED_FILES= + + +class tst_qmlcomponent : public QObject +{ + Q_OBJECT + +public: + tst_qmlcomponent(); + virtual ~tst_qmlcomponent(); + +public slots: + void initTestCase(); + void cleanupTestCase(); + +private slots: + void creation_data(); + void creation(); + +private: + QDeclarativeEngine engine; +}; + +tst_qmlcomponent::tst_qmlcomponent() +{ +} + +tst_qmlcomponent::~tst_qmlcomponent() +{ +} + +void tst_qmlcomponent::initTestCase() +{ + registerTypes(); +} + +void tst_qmlcomponent::cleanupTestCase() +{ +} + +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"; +} + +void tst_qmlcomponent::creation() +{ + QFETCH(QString, file); + + QDeclarativeComponent c(&engine, file); + QVERIFY(c.isReady()); + + QObject *obj = c.create(); + delete obj; + + QBENCHMARK { + QObject *obj = c.create(); + delete obj; + } +} + +QTEST_MAIN(tst_qmlcomponent) +#include "tst_qdeclarativecomponent.moc" diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/image.png b/tests/benchmarks/declarative/qdeclarativeimage/image.png Binary files differindex 623d362..623d362 100644 --- a/tests/benchmarks/declarative/qmlgraphicsimage/image.png +++ b/tests/benchmarks/declarative/qdeclarativeimage/image.png diff --git a/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro new file mode 100644 index 0000000..bbe4e8d --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativeimage/qdeclarativeimage.pro @@ -0,0 +1,16 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qdeclarativeimage +QT += declarative +macx:CONFIG -= app_bundle +CONFIG += release + +SOURCES += tst_qdeclarativeimage.cpp + +symbian* { + data.sources = image.png + data.path = . + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} diff --git a/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp new file mode 100644 index 0000000..4bba022 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativeimage/tst_qdeclarativeimage.cpp @@ -0,0 +1,108 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <private/qdeclarativeimage_p.h> + +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "" +#endif + +class tst_qmlgraphicsimage : public QObject +{ + Q_OBJECT +public: + tst_qmlgraphicsimage() {} + +private slots: + void qmlgraphicsimage(); + void qmlgraphicsimage_file(); + void qmlgraphicsimage_url(); + +private: + QDeclarativeEngine engine; +}; + +void tst_qmlgraphicsimage::qmlgraphicsimage() +{ + int x = 0; + QUrl url("image.png"); + QBENCHMARK { + QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); + QDeclarativeImage *image = new QDeclarativeImage; + QDeclarativeEngine::setContextForObject(image, engine.rootContext()); + delete image; + } +} + +void tst_qmlgraphicsimage::qmlgraphicsimage_file() +{ + int x = 0; + QUrl url("image.png"); + QBENCHMARK { + QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); + QDeclarativeImage *image = new QDeclarativeImage; + QDeclarativeEngine::setContextForObject(image, engine.rootContext()); + image->setSource(url); + delete image; + } +} + +void tst_qmlgraphicsimage::qmlgraphicsimage_url() +{ + int x = 0; + QUrl url("image.png"); + QBENCHMARK { + QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); + QDeclarativeImage *image = new QDeclarativeImage; + QDeclarativeEngine::setContextForObject(image, engine.rootContext()); + image->setSource(url2); + delete image; + } +} + +QTEST_MAIN(tst_qmlgraphicsimage) + +#include "tst_qdeclarativeimage.moc" diff --git a/tests/benchmarks/declarative/qmlmetaproperty/data/object.qml b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml index 11b95e1..11b95e1 100644 --- a/tests/benchmarks/declarative/qmlmetaproperty/data/object.qml +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/object.qml diff --git a/tests/benchmarks/declarative/qmlmetaproperty/data/synthesized_object.qml b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml index a923a0a..a923a0a 100644 --- a/tests/benchmarks/declarative/qmlmetaproperty/data/synthesized_object.qml +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/data/synthesized_object.qml diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro new file mode 100644 index 0000000..8070768 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/qdeclarativemetaproperty.pro @@ -0,0 +1,8 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = tst_qdeclarativemetaproperty +QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += tst_qdeclarativemetaproperty.cpp + diff --git a/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp new file mode 100644 index 0000000..dae1751 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativemetaproperty/tst_qdeclarativemetaproperty.cpp @@ -0,0 +1,113 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDeclarativeMetaProperty> +#include <QFile> +#include <QDebug> + +//TESTED_FILES= + + +class tst_qmlmetaproperty : public QObject +{ + Q_OBJECT + +public: + tst_qmlmetaproperty(); + virtual ~tst_qmlmetaproperty(); + +public slots: + void init(); + void cleanup(); + +private slots: + void lookup_data(); + void lookup(); + +private: + QDeclarativeEngine engine; +}; + +tst_qmlmetaproperty::tst_qmlmetaproperty() +{ +} + +tst_qmlmetaproperty::~tst_qmlmetaproperty() +{ +} + +void tst_qmlmetaproperty::init() +{ +} + +void tst_qmlmetaproperty::cleanup() +{ +} + +void tst_qmlmetaproperty::lookup_data() +{ + QTest::addColumn<QString>("file"); + + QTest::newRow("Simple Object") << "data/object.qml"; + QTest::newRow("Synthesized Object") << "data/synthesized_object.qml"; +} + +void tst_qmlmetaproperty::lookup() +{ + QFETCH(QString, file); + + QDeclarativeComponent c(&engine, file); + QVERIFY(c.isReady()); + + QObject *obj = c.create(); + + QBENCHMARK { + QDeclarativeMetaProperty p(obj, "x"); + } + + delete obj; +} + +QTEST_MAIN(tst_qmlmetaproperty) +#include "tst_qdeclarativemetaproperty.moc" diff --git a/tests/benchmarks/declarative/qdeclarativetime/example.qml b/tests/benchmarks/declarative/qdeclarativetime/example.qml new file mode 100644 index 0000000..dd6185d --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/example.qml @@ -0,0 +1,14 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + property string name: "Bob Smith" + + QDeclarativeTime.Timer { + component: Item { + Text { text: name } + } + } +} + diff --git a/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp new file mode 100644 index 0000000..a924337 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.cpp @@ -0,0 +1,231 @@ +/**************************************************************************** +** +** 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 <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <QDebug> +#include <QApplication> +#include <QTime> +#include <QDeclarativeContext> +#include <QGraphicsScene> +#include <QGraphicsRectItem> + +class Timer : public QObject +{ + Q_OBJECT + Q_PROPERTY(QDeclarativeComponent *component READ component WRITE setComponent); + +public: + Timer(); + + QDeclarativeComponent *component() const; + void setComponent(QDeclarativeComponent *); + + static Timer *timerInstance(); + + void run(uint); + + bool willParent() const; + void setWillParent(bool p); + +private: + void runTest(QDeclarativeContext *, uint); + + QDeclarativeComponent *m_component; + static Timer *m_timer; + + bool m_willparent; + QGraphicsScene m_scene; + QGraphicsRectItem m_item; +}; +QML_DECLARE_TYPE(Timer); + +Timer *Timer::m_timer = 0; + +Timer::Timer() +: m_component(0), m_willparent(false) +{ + if (m_timer) + qWarning("Timer: Timer already registered"); + m_timer = this; + + m_scene.setItemIndexMethod(QGraphicsScene::NoIndex); + m_scene.addItem(&m_item); +} + +QDeclarativeComponent *Timer::component() const +{ + return m_component; +} + +void Timer::setComponent(QDeclarativeComponent *c) +{ + m_component = c; +} + +Timer *Timer::timerInstance() +{ + return m_timer; +} + +void Timer::run(uint iterations) +{ + QDeclarativeContext context(qmlContext(this)); + + QObject *o = m_component->create(&context); + QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); + if (m_willparent && go) + go->setParentItem(&m_item); + delete o; + + runTest(&context, iterations); +} + +bool Timer::willParent() const +{ + return m_willparent; +} + +void Timer::setWillParent(bool p) +{ + m_willparent = p; +} + +void Timer::runTest(QDeclarativeContext *context, uint iterations) +{ + QTime t; + t.start(); + for (uint ii = 0; ii < iterations; ++ii) { + QObject *o = m_component->create(context); + QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); + if (m_willparent && go) + go->setParentItem(&m_item); + delete o; + } + + int e = t.elapsed(); + + qWarning() << "Total:" << e << "ms, Per iteration:" << qreal(e) / qreal(iterations) << "ms"; + +} + +void usage(const char *name) +{ + qWarning("Usage: %s [-iterations <count>] [-parent] <qml file>", name); + exit(-1); +} + +int main(int argc, char ** argv) +{ + QApplication app(argc, argv); + + QML_REGISTER_TYPE(QDeclarativeTime, 1, 0, Timer, Timer); + + uint iterations = 1024; + QString filename; + bool willParent = false; + + for (int ii = 1; ii < argc; ++ii) { + QByteArray arg(argv[ii]); + + if (arg == "-iterations") { + if (ii + 1 < argc) { + ++ii; + QByteArray its(argv[ii]); + bool ok = false; + iterations = its.toUInt(&ok); + if (!ok) + usage(argv[0]); + } else { + usage(argv[0]); + } + } else if (arg == "-parent") { + willParent = true; + } else { + filename = QLatin1String(argv[ii]); + } + } + + if (filename.isEmpty()) +#ifdef Q_OS_SYMBIAN + filename = QLatin1String("./tests/item_creation/data.qml"); +#else + usage(argv[0]); +#endif + + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, filename); + if (component.isError()) { + qWarning() << component.errors(); + return -1; + } + + QObject *obj = component.create(); + if (!obj) { + qWarning() << component.errors(); + return -1; + } + + Timer *timer = Timer::timerInstance(); + if (!timer) { + qWarning() << "A Tester.Timer instance is required."; + return -1; + } + +#ifdef Q_OS_SYMBIAN + willParent = true; +#endif + timer->setWillParent(willParent); + + if (!timer->component()) { + qWarning() << "The timer has no component"; + return -1; + } + +#ifdef Q_OS_SYMBIAN + iterations = 1024; +#endif + + timer->run(iterations); + + return 0; +} + +#include "qdeclarativetime.moc" diff --git a/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.pro b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.pro new file mode 100644 index 0000000..7902ee1 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/qdeclarativetime.pro @@ -0,0 +1,23 @@ +load(qttest_p4) +TEMPLATE = app +TARGET = qdeclarativetime +QT += declarative +macx:CONFIG -= app_bundle + +SOURCES += qdeclarativetime.cpp + +symbian* { + TARGET.CAPABILITY = "All -TCB" + example.sources = example.qml + esample.path = . + tests.sources = tests/* + tests.path = tests + anshors.sources = tests/anchors/* + anchors.path = tests/anchors + item_creation.sources = tests/item_creation/* + item_creation.path = tests/item_creation + positioner_creation.sources = tests/positioner_creation/* + positioner_creation.path = tests/positioner_creation + DEPLOYMENT += example tests anchors item_creation positioner_creation +} + diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/empty.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/empty.qml new file mode 100644 index 0000000..8d93594 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/empty.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + Item { + anchors.leftMargin: 0 + } + } + } + } +} + diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/fill.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/fill.qml new file mode 100644 index 0000000..918c48a --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/fill.qml @@ -0,0 +1,41 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + Item { + anchors.fill: parent + anchors.leftMargin: 0 + } + } + } + } +} + diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/null.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/null.qml new file mode 100644 index 0000000..bb84538 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/anchors/null.qml @@ -0,0 +1,27 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + Item { + } + Item { + } + Item { + } + Item { + } + Item { + } + Item { + } + Item { + } + } + } + } +} + diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/children.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/children.qml new file mode 100644 index 0000000..3387a32 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/children.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + children: [ + Rectangle { }, + Rectangle { }, + Item { }, + Image { }, + Text { }, + Item { }, + Item { }, + Image { }, + Image { }, + Row { }, + Image { }, + Image { }, + Column { }, + Row { }, + Text { }, + Text { }, + Text { }, + MouseArea { } + ] + + } + } + } + +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/data.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/data.qml new file mode 100644 index 0000000..a8b653c --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/data.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + data: [ + Rectangle { }, + Rectangle { }, + Item { }, + Image { }, + Text { }, + Item { }, + Item { }, + Image { }, + Image { }, + Row { }, + Image { }, + Image { }, + Column { }, + Row { }, + Text { }, + Text { }, + Text { }, + MouseArea { } + ] + + } + } + } + +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/no_creation.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/no_creation.qml new file mode 100644 index 0000000..0a507d4 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/no_creation.qml @@ -0,0 +1,12 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + } + } + } +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/resources.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/resources.qml new file mode 100644 index 0000000..227d8ad --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/item_creation/resources.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + + QDeclarativeTime.Timer { + component: Component { + Item { + resources: [ + Rectangle { }, + Rectangle { }, + Item { }, + Image { }, + Text { }, + Item { }, + Item { }, + Image { }, + Image { }, + Row { }, + Image { }, + Image { }, + Column { }, + Row { }, + Text { }, + Text { }, + Text { }, + MouseArea { } + ] + + } + } + } + +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/no_positioner.qml new file mode 100644 index 0000000..c1f54a4 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/no_positioner.qml @@ -0,0 +1,37 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + QDeclarativeTime.Timer { + component: Component { + Item { + Rectangle { } + Rectangle { } + Item { + Image { } + Text { } + } + + Item { + Item { + Image { } + Image { } + Item { + Image { } + Image { } + } + } + + Item { + Item { + Text { } + Text { } + } + Text { } + } + } + MouseArea { } + } + } + } +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/null_positioner.qml new file mode 100644 index 0000000..d49ff78 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/null_positioner.qml @@ -0,0 +1,34 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + QDeclarativeTime.Timer { + component: Component { + Item { + Rectangle { } + Rectangle { } + Item { + Image { } + Text { } + } + + Item { + Item { + Image { } + Image { } + Row { } + Image { } + Image { } + } + + Column { } + Row { } + Text { } + Text { } + Text { } + } + MouseArea { } + } + } + } +} diff --git a/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/positioner.qml b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/positioner.qml new file mode 100644 index 0000000..05ca804 --- /dev/null +++ b/tests/benchmarks/declarative/qdeclarativetime/tests/positioner_creation/positioner.qml @@ -0,0 +1,37 @@ +import Qt 4.6 +import QDeclarativeTime 1.0 as QDeclarativeTime + +Item { + QDeclarativeTime.Timer { + component: Component { + Item { + Rectangle { } + Rectangle { } + Item { + Image { } + Text { } + } + + Item { + Item { + Image { } + Image { } + Row { + Image { } + Image { } + } + } + + Column { + Row { + Text { } + Text { } + } + Text { } + } + } + MouseArea { } + } + } + } +} diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro deleted file mode 100644 index 6a86f58..0000000 --- a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro +++ /dev/null @@ -1,9 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmlcomponent -QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlcomponent.cpp testtypes.cpp -HEADERS += testtypes.h - diff --git a/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp b/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp deleted file mode 100644 index f0bc1f9..0000000 --- a/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp +++ /dev/null @@ -1,43 +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" - -QML_DEFINE_TYPE(Qt.test, 4, 6, MyQmlObject, MyQmlObject); diff --git a/tests/benchmarks/declarative/qmlcomponent/testtypes.h b/tests/benchmarks/declarative/qmlcomponent/testtypes.h deleted file mode 100644 index d4e0a1a..0000000 --- a/tests/benchmarks/declarative/qmlcomponent/testtypes.h +++ /dev/null @@ -1,81 +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$ -** -****************************************************************************/ -#ifndef TESTTYPES_H -#define TESTTYPES_H - -#include <QtCore/qobject.h> -#include <QtDeclarative/qml.h> - -class MyQmlObject : public QObject -{ - Q_OBJECT - 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(QmlList<QObject *> *data READ data); - Q_CLASSINFO("DefaultProperty", "data"); -public: - MyQmlObject() : m_result(0), m_value(0), m_object(0) {} - - int result() const { return m_result; } - void setResult(int r) { m_result = r; } - - int value() const { return m_value; } - void setValue(int v) { m_value = v; emit valueChanged(); } - - QmlList<QObject *> *data() { return &m_data; } - - MyQmlObject *object() const { return m_object; } - void setObject(MyQmlObject *o) { m_object = o; emit objectChanged(); } - -signals: - void valueChanged(); - void objectChanged(); - -private: - QmlConcreteList<QObject *> m_data; - int m_result; - int m_value; - MyQmlObject *m_object; -}; -QML_DECLARE_TYPE(MyQmlObject); - -#endif // TESTTYPES_H diff --git a/tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp b/tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp deleted file mode 100644 index 647edbf..0000000 --- a/tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp +++ /dev/null @@ -1,118 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QFile> -#include <QDebug> -#include "testtypes.h" - -//TESTED_FILES= - - -class tst_qmlcomponent : public QObject -{ - Q_OBJECT - -public: - tst_qmlcomponent(); - virtual ~tst_qmlcomponent(); - -public slots: - void init(); - void cleanup(); - -private slots: - void creation_data(); - void creation(); - -private: - QmlEngine engine; -}; - -tst_qmlcomponent::tst_qmlcomponent() -{ -} - -tst_qmlcomponent::~tst_qmlcomponent() -{ -} - -void tst_qmlcomponent::init() -{ -} - -void tst_qmlcomponent::cleanup() -{ -} - -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"; -} - -void tst_qmlcomponent::creation() -{ - QFETCH(QString, file); - - QmlComponent c(&engine, file); - QVERIFY(c.isReady()); - - QObject *obj = c.create(); - delete obj; - - QBENCHMARK { - QObject *obj = c.create(); - delete obj; - } -} - -QTEST_MAIN(tst_qmlcomponent) -#include "tst_qmlcomponent.moc" diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro b/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro deleted file mode 100644 index 449d874..0000000 --- a/tests/benchmarks/declarative/qmlgraphicsimage/qmlgraphicsimage.pro +++ /dev/null @@ -1,11 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmlgraphicsimage -QT += declarative -macx:CONFIG -= app_bundle -CONFIG += release - -SOURCES += tst_qmlgraphicsimage.cpp - -DEFINES += SRCDIR=\\\"$$PWD\\\" - diff --git a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp b/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp deleted file mode 100644 index 7d7d24e..0000000 --- a/tests/benchmarks/declarative/qmlgraphicsimage/tst_qmlgraphicsimage.cpp +++ /dev/null @@ -1,102 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <private/qmlgraphicsimage_p.h> - -class tst_qmlgraphicsimage : public QObject -{ - Q_OBJECT -public: - tst_qmlgraphicsimage() {} - -private slots: - void qmlgraphicsimage(); - void qmlgraphicsimage_file(); - void qmlgraphicsimage_url(); - -private: - QmlEngine engine; -}; - -void tst_qmlgraphicsimage::qmlgraphicsimage() -{ - int x = 0; - QUrl url("image.png"); - QBENCHMARK { - QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); - QmlGraphicsImage *image = new QmlGraphicsImage; - QmlEngine::setContextForObject(image, engine.rootContext()); - delete image; - } -} - -void tst_qmlgraphicsimage::qmlgraphicsimage_file() -{ - int x = 0; - QUrl url("image.png"); - QBENCHMARK { - QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); - QmlGraphicsImage *image = new QmlGraphicsImage; - QmlEngine::setContextForObject(image, engine.rootContext()); - image->setSource(url); - delete image; - } -} - -void tst_qmlgraphicsimage::qmlgraphicsimage_url() -{ - int x = 0; - QUrl url("image.png"); - QBENCHMARK { - QUrl url2("http://localhost/image" + QString::number(x++) + ".png"); - QmlGraphicsImage *image = new QmlGraphicsImage; - QmlEngine::setContextForObject(image, engine.rootContext()); - image->setSource(url2); - delete image; - } -} - -QTEST_MAIN(tst_qmlgraphicsimage) - -#include "tst_qmlgraphicsimage.moc" diff --git a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro deleted file mode 100644 index c18a56b..0000000 --- a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = tst_qmlmetaproperty -QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += tst_qmlmetaproperty.cpp - diff --git a/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp deleted file mode 100644 index 4c002f8..0000000 --- a/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp +++ /dev/null @@ -1,113 +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 <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <QmlMetaProperty> -#include <QFile> -#include <QDebug> - -//TESTED_FILES= - - -class tst_qmlmetaproperty : public QObject -{ - Q_OBJECT - -public: - tst_qmlmetaproperty(); - virtual ~tst_qmlmetaproperty(); - -public slots: - void init(); - void cleanup(); - -private slots: - void lookup_data(); - void lookup(); - -private: - QmlEngine engine; -}; - -tst_qmlmetaproperty::tst_qmlmetaproperty() -{ -} - -tst_qmlmetaproperty::~tst_qmlmetaproperty() -{ -} - -void tst_qmlmetaproperty::init() -{ -} - -void tst_qmlmetaproperty::cleanup() -{ -} - -void tst_qmlmetaproperty::lookup_data() -{ - QTest::addColumn<QString>("file"); - - QTest::newRow("Simple Object") << "data/object.qml"; - QTest::newRow("Synthesized Object") << "data/synthesized_object.qml"; -} - -void tst_qmlmetaproperty::lookup() -{ - QFETCH(QString, file); - - QmlComponent c(&engine, file); - QVERIFY(c.isReady()); - - QObject *obj = c.create(); - - QBENCHMARK { - QmlMetaProperty p(obj, "x"); - } - - delete obj; -} - -QTEST_MAIN(tst_qmlmetaproperty) -#include "tst_qmlmetaproperty.moc" diff --git a/tests/benchmarks/declarative/qmltime/example.qml b/tests/benchmarks/declarative/qmltime/example.qml deleted file mode 100644 index 68889f0..0000000 --- a/tests/benchmarks/declarative/qmltime/example.qml +++ /dev/null @@ -1,14 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - property string name: "Bob Smith" - - QmlTime.Timer { - component: Item { - Text { text: name } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/qmltime.cpp b/tests/benchmarks/declarative/qmltime/qmltime.cpp deleted file mode 100644 index 2cc5d0d..0000000 --- a/tests/benchmarks/declarative/qmltime/qmltime.cpp +++ /dev/null @@ -1,219 +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 <QmlEngine> -#include <QmlComponent> -#include <QDebug> -#include <QApplication> -#include <QTime> -#include <QmlContext> -#include <QGraphicsScene> -#include <QGraphicsRectItem> - -class Timer : public QObject -{ - Q_OBJECT - Q_PROPERTY(QmlComponent *component READ component WRITE setComponent); - -public: - Timer(); - - QmlComponent *component() const; - void setComponent(QmlComponent *); - - static Timer *timerInstance(); - - void run(uint); - - bool willParent() const; - void setWillParent(bool p); - -private: - void runTest(QmlContext *, uint); - - QmlComponent *m_component; - static Timer *m_timer; - - bool m_willparent; - QGraphicsScene m_scene; - QGraphicsRectItem m_item; -}; -QML_DECLARE_TYPE(Timer); -QML_DEFINE_TYPE(QmlTime, 1, 0, Timer, Timer); - -Timer *Timer::m_timer = 0; - -Timer::Timer() -: m_component(0), m_willparent(false) -{ - if (m_timer) - qWarning("Timer: Timer already registered"); - m_timer = this; - - m_scene.setItemIndexMethod(QGraphicsScene::NoIndex); - m_scene.addItem(&m_item); -} - -QmlComponent *Timer::component() const -{ - return m_component; -} - -void Timer::setComponent(QmlComponent *c) -{ - m_component = c; -} - -Timer *Timer::timerInstance() -{ - return m_timer; -} - -void Timer::run(uint iterations) -{ - QmlContext context(qmlContext(this)); - - QObject *o = m_component->create(&context); - QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) - go->setParentItem(&m_item); - delete o; - - runTest(&context, iterations); -} - -bool Timer::willParent() const -{ - return m_willparent; -} - -void Timer::setWillParent(bool p) -{ - m_willparent = p; -} - -void Timer::runTest(QmlContext *context, uint iterations) -{ - QTime t; - t.start(); - for (uint ii = 0; ii < iterations; ++ii) { - QObject *o = m_component->create(context); - QGraphicsObject *go = qobject_cast<QGraphicsObject *>(o); - if (m_willparent && go) - go->setParentItem(&m_item); - delete o; - } - - int e = t.elapsed(); - - qWarning() << "Total:" << e << "ms, Per iteration:" << qreal(e) / qreal(iterations) << "ms"; - -} - -void usage(const char *name) -{ - qWarning("Usage: %s [-iterations <count>] [-parent] <qml file>", name); - exit(-1); -} - -int main(int argc, char ** argv) -{ - QApplication app(argc, argv); - - uint iterations = 1024; - QString filename; - bool willParent = false; - - for (int ii = 1; ii < argc; ++ii) { - QByteArray arg(argv[ii]); - - if (arg == "-iterations") { - if (ii + 1 < argc) { - ++ii; - QByteArray its(argv[ii]); - bool ok = false; - iterations = its.toUInt(&ok); - if (!ok) - usage(argv[0]); - } else { - usage(argv[0]); - } - } else if (arg == "-parent") { - willParent = true; - } else { - filename = QLatin1String(argv[ii]); - } - } - - if (filename.isEmpty()) - usage(argv[0]); - - QmlEngine engine; - QmlComponent component(&engine, filename); - if (component.isError()) { - qWarning() << component.errors(); - return -1; - } - - QObject *obj = component.create(); - if (!obj) { - qWarning() << component.errors(); - return -1; - } - - Timer *timer = Timer::timerInstance(); - if (!timer) { - qWarning() << "A Tester.Timer instance is required."; - return -1; - } - - timer->setWillParent(willParent); - - if (!timer->component()) { - qWarning() << "The timer has no component"; - return -1; - } - - timer->run(iterations); - - return 0; -} - -#include "qmltime.moc" diff --git a/tests/benchmarks/declarative/qmltime/qmltime.pro b/tests/benchmarks/declarative/qmltime/qmltime.pro deleted file mode 100644 index b077d1a..0000000 --- a/tests/benchmarks/declarative/qmltime/qmltime.pro +++ /dev/null @@ -1,8 +0,0 @@ -load(qttest_p4) -TEMPLATE = app -TARGET = qmltime -QT += declarative -macx:CONFIG -= app_bundle - -SOURCES += qmltime.cpp - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml deleted file mode 100644 index 31c879b..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/empty.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - Item { - anchors.leftMargin: 0 - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml deleted file mode 100644 index 23fe78e..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/fill.qml +++ /dev/null @@ -1,41 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - Item { - anchors.fill: parent - anchors.leftMargin: 0 - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml b/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml deleted file mode 100644 index bc447ef..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/anchors/null.qml +++ /dev/null @@ -1,27 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - Item { - } - } - } - } -} - diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml deleted file mode 100644 index 996602c..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/children.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - children: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml deleted file mode 100644 index 9f79c34..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/data.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - data: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml deleted file mode 100644 index f228c2a..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/no_creation.qml +++ /dev/null @@ -1,12 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml b/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml deleted file mode 100644 index 335aeb8..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/item_creation/resources.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - - QmlTime.Timer { - component: Component { - Item { - resources: [ - Rectangle { }, - Rectangle { }, - Item { }, - Image { }, - Text { }, - Item { }, - Item { }, - Image { }, - Image { }, - Row { }, - Image { }, - Image { }, - Column { }, - Row { }, - Text { }, - Text { }, - Text { }, - MouseArea { } - ] - - } - } - } - -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml deleted file mode 100644 index 97bad47..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/no_positioner.qml +++ /dev/null @@ -1,37 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Item { - Image { } - Image { } - } - } - - Item { - Item { - Text { } - Text { } - } - Text { } - } - } - MouseArea { } - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml deleted file mode 100644 index 36dda15..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/null_positioner.qml +++ /dev/null @@ -1,34 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Row { } - Image { } - Image { } - } - - Column { } - Row { } - Text { } - Text { } - Text { } - } - MouseArea { } - } - } - } -} diff --git a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml b/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml deleted file mode 100644 index 396e27d..0000000 --- a/tests/benchmarks/declarative/qmltime/tests/positioner_creation/positioner.qml +++ /dev/null @@ -1,37 +0,0 @@ -import Qt 4.6 -import QmlTime 1.0 as QmlTime - -Item { - QmlTime.Timer { - component: Component { - Item { - Rectangle { } - Rectangle { } - Item { - Image { } - Text { } - } - - Item { - Item { - Image { } - Image { } - Row { - Image { } - Image { } - } - } - - Column { - Row { - Text { } - Text { } - } - Text { } - } - } - MouseArea { } - } - } - } -} diff --git a/tests/benchmarks/declarative/script/script.pro b/tests/benchmarks/declarative/script/script.pro index 48fea81..6255acc 100644 --- a/tests/benchmarks/declarative/script/script.pro +++ b/tests/benchmarks/declarative/script/script.pro @@ -7,5 +7,14 @@ CONFIG += release SOURCES += tst_script.cpp -DEFINES += SRCDIR=\\\"$$PWD\\\" +symbian* { + data.sources = data/* + data.path = data + DEPLOYMENT += data +} else { + DEFINES += SRCDIR=\\\"$$PWD\\\" +} + + + diff --git a/tests/benchmarks/declarative/script/tst_script.cpp b/tests/benchmarks/declarative/script/tst_script.cpp index dd21997..61f5fc8 100644 --- a/tests/benchmarks/declarative/script/tst_script.cpp +++ b/tests/benchmarks/declarative/script/tst_script.cpp @@ -40,14 +40,20 @@ ****************************************************************************/ #include <qtest.h> -#include <QmlEngine> -#include <QmlComponent> -#include <private/qmlengine_p.h> -#include <private/qmlobjectscriptclass_p.h> -#include <private/qmlgraphicsrectangle_p.h> +#include <QDeclarativeEngine> +#include <QDeclarativeComponent> +#include <private/qdeclarativeengine_p.h> +#include <private/qdeclarativeobjectscriptclass_p.h> +#include <private/qdeclarativerectangle_p.h> #include <QScriptEngine> #include <QScriptValue> +#ifdef Q_OS_SYMBIAN +// In Symbian OS test data is located in applications private dir +// Application private dir is default serach path for files, so SRCDIR can be set to empty +#define SRCDIR "." +#endif + class tst_script : public QObject { Q_OBJECT @@ -55,6 +61,8 @@ public: tst_script() {} private slots: + void initTestCase(); + void property_js(); void property_getter(); void property_getter_js(); @@ -88,6 +96,11 @@ 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); @@ -123,7 +136,6 @@ private: int m_x; }; QML_DECLARE_TYPE(TestObject); -QML_DEFINE_TYPE(Qt.test, 1, 0, TestObject, TestObject); TestObject::TestObject(QObject *parent) : QObject(parent), m_x(0) @@ -289,12 +301,12 @@ void tst_script::property_qobject() void tst_script::property_qmlobject() { - QmlEngine qmlengine; + QDeclarativeEngine qmlengine; - QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(&qmlengine); + QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); QScriptValueList args; args << v; @@ -373,12 +385,12 @@ void tst_script::function_qobject() void tst_script::function_qmlobject() { - QmlEngine qmlengine; + QDeclarativeEngine qmlengine; - QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(&qmlengine); + QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); QScriptValueList args; args << v; @@ -457,12 +469,12 @@ void tst_script::function_args_qobject() void tst_script::function_args_qmlobject() { - QmlEngine qmlengine; + QDeclarativeEngine qmlengine; - QScriptEngine *engine = QmlEnginePrivate::getScriptEngine(&qmlengine); + QScriptEngine *engine = QDeclarativeEnginePrivate::getScriptEngine(&qmlengine); TestObject to; - QScriptValue v = QmlEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); + QScriptValue v = QDeclarativeEnginePrivate::get(&qmlengine)->objectClass->newQObject(&to); QScriptValueList args; args << v; @@ -476,8 +488,8 @@ void tst_script::function_args_qmlobject() void tst_script::signal_unconnected() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("signal_unconnected.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_unconnected.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -490,8 +502,8 @@ void tst_script::signal_unconnected() void tst_script::signal_qml() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("signal_qml.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_qml.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -504,8 +516,8 @@ void tst_script::signal_qml() void tst_script::signal_args() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("signal_args.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_args.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -518,8 +530,8 @@ void tst_script::signal_args() void tst_script::signal_unusedArgs() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("signal_unusedArgs.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("signal_unusedArgs.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -532,8 +544,8 @@ void tst_script::signal_unusedArgs() void tst_script::slot_simple() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("slot_simple.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("slot_simple.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -546,8 +558,8 @@ void tst_script::slot_simple() void tst_script::slot_simple_js() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("slot_simple_js.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("slot_simple_js.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -560,8 +572,8 @@ void tst_script::slot_simple_js() void tst_script::slot_complex() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("slot_complex.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("slot_complex.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -574,8 +586,8 @@ void tst_script::slot_complex() void tst_script::slot_complex_js() { - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("slot_complex_js.qml")); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("slot_complex_js.qml")); TestObject *object = qobject_cast<TestObject *>(component.create()); QVERIFY(object != 0); @@ -597,9 +609,9 @@ void tst_script::block_data() void tst_script::block() { QFETCH(QString, methodName); - QmlEngine engine; - QmlComponent component(&engine, TEST_FILE("block.qml")); - QmlGraphicsRectangle *rect = qobject_cast<QmlGraphicsRectangle *>(component.create()); + QDeclarativeEngine engine; + QDeclarativeComponent component(&engine, TEST_FILE("block.qml")); + QDeclarativeRectangle *rect = qobject_cast<QDeclarativeRectangle *>(component.create()); QVERIFY(rect != 0); int index = rect->metaObject()->indexOfMethod(methodName.toUtf8()); diff --git a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp index b904f40..2c1274c 100644 --- a/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp +++ b/tests/benchmarks/gui/graphicsview/functional/GraphicsViewBenchmark/main.cpp @@ -751,7 +751,7 @@ int main(int argc, char *argv[]) aargv[aargc++] = argv[i]; } - QApplication app(argc, argv); + QApplication app(aargc, aargv); int returnValue = 0; if (settings.options() & Settings::ManualTest) { diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp index 1028f42..6c4ca08 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/chipTest/view.cpp @@ -42,7 +42,14 @@ #include "view.h" #include <QtGui> + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif + #ifndef QT_NO_OPENGL #include <QtOpenGL> #endif diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp index 527713f..63b0da9 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/moveItems/main.cpp @@ -39,7 +39,13 @@ ** ****************************************************************************/ #include <QtGui> + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif #ifdef Q_WS_X11 extern void qt_x11_wait_for_window_manager(QWidget *); diff --git a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp index 7419206..3f30393 100644 --- a/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp +++ b/tests/benchmarks/gui/graphicsview/qgraphicsview/benchapps/scrolltest/main.cpp @@ -39,7 +39,13 @@ ** ****************************************************************************/ #include <QtGui> + +#ifdef Q_WS_WIN +#define CALLGRIND_START_INSTRUMENTATION {} +#define CALLGRIND_STOP_INSTRUMENTATION {} +#else #include "valgrind/callgrind.h" +#endif class ItemMover : public QObject { diff --git a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp index f21bd44..8c30be4 100644 --- a/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp +++ b/tests/benchmarks/gui/kernel/qwidget/tst_qwidget.cpp @@ -42,33 +42,35 @@ #include <qtest.h> #include <QtGui> -class tst_QWidget : public QObject +static void processEvents() { - Q_OBJECT - - -private slots: - void update_data(); - void updateOpaque_data(); - void updateOpaque(); - void updateTransparent_data(); - void updateTransparent(); - void updatePartial_data(); - void updatePartial(); - void updateComplex_data(); - void updateComplex(); - - void complexToplevelResize(); -}; + QApplication::flush(); + QApplication::processEvents(); + QApplication::processEvents(); +} class UpdateWidget : public QWidget { public: - UpdateWidget(int rows, int columns) : QWidget(0) + UpdateWidget(int rows, int columns) + : QWidget(0), rowCount(0), columnCount(0), opaqueChildren(false) { + fill(rows, columns); + } + + UpdateWidget(QWidget *parent = 0) + : QWidget(parent), rowCount(0), columnCount(0), opaqueChildren(false) {} + + void fill(int rows, int columns) + { + if (rows == rowCount && columns == columnCount) + return; + delete layout(); QGridLayout *layout = new QGridLayout; - for (int row = 0; row < rows; ++row) { - for (int column = 0; column < columns; ++column) { + rowCount = rows; + columnCount = columns; + for (int row = 0; row < rowCount; ++row) { + for (int column = 0; column < columnCount; ++column) { UpdateWidget *widget = new UpdateWidget; widget->setFixedSize(20, 20); layout->addWidget(widget, row, column); @@ -76,9 +78,20 @@ public: } } setLayout(layout); + adjustSize(); + QTest::qWait(250); + processEvents(); } - UpdateWidget(QWidget *parent = 0) : QWidget(parent) {} + void setOpaqueChildren(bool enable) + { + if (opaqueChildren != enable) { + foreach (QWidget *w, children) + w->setAttribute(Qt::WA_OpaquePaintEvent, enable); + opaqueChildren = enable; + processEvents(); + } + } void paintEvent(QPaintEvent *) { @@ -93,75 +106,86 @@ public: QRegion updateRegion; QList<UpdateWidget*> children; + int rowCount; + int columnCount; + bool opaqueChildren; }; -void tst_QWidget::update_data() +class tst_QWidget : public QObject { - QTest::addColumn<int>("rows"); - QTest::addColumn<int>("columns"); - QTest::addColumn<int>("numUpdates"); - - QTest::newRow("10x10x1") << 10 << 10 << 1; - QTest::newRow("10x10x10") << 10 << 10 << 10; - QTest::newRow("25x25x1") << 25 << 25 << 1; - QTest::newRow("25x25x10") << 25 << 25 << 10; - QTest::newRow("25x25x100") << 25 << 25 << 100; -} + Q_OBJECT -void tst_QWidget::updateOpaque_data() -{ - update_data(); -} +public slots: + void initTestCase(); + void init(); -void tst_QWidget::updateOpaque() -{ - QFETCH(int, rows); - QFETCH(int, columns); - QFETCH(int, numUpdates); +private slots: + void update_data(); + void update(); + void updatePartial_data(); + void updatePartial(); + void updateComplex_data(); + void updateComplex(); - UpdateWidget widget(rows, columns); - foreach (QWidget *w, widget.children) { - w->setAttribute(Qt::WA_OpaquePaintEvent); - } +private: + UpdateWidget widget; +}; +void tst_QWidget::initTestCase() +{ widget.show(); - QApplication::processEvents(); + QTest::qWaitForWindowShown(&widget); + QTest::qWait(300); + processEvents(); +} - int i = 0; - const int n = widget.children.size(); - QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); - QApplication::processEvents(); - i = (i + 1) % n; - } - } +void tst_QWidget::init() +{ + QVERIFY(widget.isVisible()); + for (int i = 0; i < 3; ++i) + processEvents(); } -void tst_QWidget::updateTransparent_data() +void tst_QWidget::update_data() { - update_data(); + QTest::addColumn<int>("rows"); + QTest::addColumn<int>("columns"); + QTest::addColumn<int>("numUpdates"); + QTest::addColumn<bool>("opaque"); + + QTest::newRow("10x10x1 transparent") << 10 << 10 << 1 << false; + QTest::newRow("10x10x10 transparent") << 10 << 10 << 10 << false; + QTest::newRow("10x10x100 transparent") << 10 << 10 << 100 << false; + QTest::newRow("10x10x1 opaque") << 10 << 10 << 1 << true; + QTest::newRow("10x10x10 opaque") << 10 << 10 << 10 << true; + QTest::newRow("10x10x100 opaque") << 10 << 10 << 100 << true; + QTest::newRow("25x25x1 transparent ") << 25 << 25 << 1 << false; + QTest::newRow("25x25x10 transparent") << 25 << 25 << 10 << false; + QTest::newRow("25x25x100 transparent") << 25 << 25 << 100 << false; + QTest::newRow("25x25x1 opaque") << 25 << 25 << 1 << true; + QTest::newRow("25x25x10 opaque") << 25 << 25 << 10 << true; + QTest::newRow("25x25x100 opaque") << 25 << 25 << 100 << true; } -void tst_QWidget::updateTransparent() +void tst_QWidget::update() { QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { - widget.children[i]->update(); + for (int i = 0; i < widget.children.size(); ++i) { + for (int j = 0; j < numUpdates; ++j) + widget.children.at(i)->update(); QApplication::processEvents(); - i = (i + 1) % n; } } + + QApplication::flush(); } void tst_QWidget::updatePartial_data() @@ -174,24 +198,23 @@ void tst_QWidget::updatePartial() QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { + for (int i = 0; i < widget.children.size(); ++i) { QWidget *w = widget.children[i]; const int x = w->width() / 2; const int y = w->height() / 2; - w->update(0, 0, x, y); - w->update(x, 0, x, y); - w->update(0, y, x, y); - w->update(x, y, x, y); + for (int j = 0; j < numUpdates; ++j) { + w->update(0, 0, x, y); + w->update(x, 0, x, y); + w->update(0, y, x, y); + w->update(x, y, x, y); + } QApplication::processEvents(); - i = (i + 1) % n; } } } @@ -206,127 +229,27 @@ void tst_QWidget::updateComplex() QFETCH(int, rows); QFETCH(int, columns); QFETCH(int, numUpdates); + QFETCH(bool, opaque); - UpdateWidget widget(rows, columns); - widget.show(); - QApplication::processEvents(); + widget.fill(rows, columns); + widget.setOpaqueChildren(opaque); - int i = 0; - const int n = widget.children.size(); QBENCHMARK { - for (int j = 0; j < numUpdates; ++j) { + for (int i = 0; i < widget.children.size(); ++i) { QWidget *w = widget.children[i]; const int x = w->width() / 2; const int y = w->height() / 2; - w->update(QRegion(0, 0, x, y, QRegion::Ellipse)); - w->update(QRegion(x, y, x, y, QRegion::Ellipse)); + QRegion r1(0, 0, x, y, QRegion::Ellipse); + QRegion r2(x, y, x, y, QRegion::Ellipse); + for (int j = 0; j < numUpdates; ++j) { + w->update(r1); + w->update(r2); + } QApplication::processEvents(); - i = (i + 1) % n; } } } -class ResizeWidget : public QWidget -{ -public: - ResizeWidget(); -}; - -ResizeWidget::ResizeWidget() : QWidget(0) -{ - QBoxLayout *topLayout = new QVBoxLayout; - - QMenuBar *menubar = new QMenuBar; - QMenu* popup = menubar->addMenu("&File"); - popup->addAction("&Quit", qApp, SLOT(quit())); - topLayout->setMenuBar(menubar); - - QBoxLayout *buttons = new QHBoxLayout; - buttons->setMargin(5); - buttons->addStretch(10); - for (int i = 1; i <= 4; i++ ) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - buttons = new QHBoxLayout; - buttons->addStretch(10); - for (int i = 11; i <= 16; i++) { - QPushButton* button = new QPushButton; - button->setText(QString("Button %1").arg(i)); - buttons->addWidget(button); - } - topLayout->addLayout(buttons); - - QBoxLayout *buttons2 = new QHBoxLayout; - buttons2->addStretch(10); - topLayout->addLayout(buttons2); - - QPushButton *button = new QPushButton; - button->setText("Button five"); - buttons2->addWidget(button); - - button = new QPushButton; - button->setText("Button 6"); - buttons2->addWidget(button); - - QTextEdit *bigWidget = new QTextEdit; - bigWidget->setText("This widget will get all the remaining space"); - bigWidget->setFrameStyle(QFrame::Panel | QFrame::Plain); - topLayout->addWidget(bigWidget); - - const int numRows = 6; - const int labelCol = 0; - const int linedCol = 1; - const int multiCol = 2; - - QGridLayout *grid = new QGridLayout; - for (int row = 0; row < numRows; row++) { - QLineEdit *lineEdit = new QLineEdit; - grid->addWidget(lineEdit, row, linedCol); - QLabel *label = new QLabel(QString("Line &%1").arg(row + 1)); - grid->addWidget(label, row, labelCol); - } - topLayout->addLayout(grid); - - QTextEdit *multiLineEdit = new QTextEdit; - grid->addWidget(multiLineEdit, 0, labelCol + 1, multiCol, multiCol); - - grid->setColumnStretch(linedCol, 10); - grid->setColumnStretch(multiCol, 20); - - QLabel* statusBar = new QLabel; - statusBar->setText("Let's pretend this is a status bar"); - statusBar->setFrameStyle(QFrame::Panel | QFrame::Sunken); - statusBar->setFixedHeight(statusBar->sizeHint().height()); - statusBar->setAlignment(Qt::AlignVCenter | Qt::AlignLeft); - topLayout->addWidget(statusBar); - - topLayout->activate(); - setLayout(topLayout); -} - -void tst_QWidget::complexToplevelResize() -{ - ResizeWidget w; - w.show(); - - QApplication::processEvents(); - - const int minSize = 100; - const int maxSize = 800; - int size = minSize; - - QBENCHMARK { - w.resize(size, size); - size = qMax(minSize, (size + 10) % maxSize); - QApplication::processEvents(); - QApplication::processEvents(); - } -} - QTEST_MAIN(tst_QWidget) #include "tst_qwidget.moc" diff --git a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp index 39b2244..d570bb3 100644 --- a/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp +++ b/tests/benchmarks/gui/painting/qpainter/tst_qpainter.cpp @@ -1395,7 +1395,7 @@ void tst_QPainter::drawTransformedImageRoundedRect() } } -//code from QmlGraphicsRectangle for drawing rounded rects +//code from QDeclarativeRectangle for drawing rounded rects void tst_QPainter::drawBorderPixmapRoundedRect() { //setup image @@ -1446,7 +1446,7 @@ void tst_QPainter::drawScaledBorderPixmapRoundedRect_data() // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied; } -//code from QmlGraphicsRectangle for drawing rounded rects +//code from QDeclarativeRectangle for drawing rounded rects void tst_QPainter::drawScaledBorderPixmapRoundedRect() { QFETCH(float, scale); @@ -1502,7 +1502,7 @@ void tst_QPainter::drawTransformedBorderPixmapRoundedRect_data() } -//code from QmlGraphicsRectangle for drawing rounded rects +//code from QDeclarativeRectangle for drawing rounded rects void tst_QPainter::drawTransformedBorderPixmapRoundedRect() { QFETCH(QTransform, transform); diff --git a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp index 226b661..d051b12 100644 --- a/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp +++ b/tests/benchmarks/gui/styles/qstylesheetstyle/main.cpp @@ -82,6 +82,7 @@ void tst_qstylesheetstyle::empty() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet("/*" + QString::number(i) + "*/"); @@ -94,6 +95,7 @@ void tst_qstylesheetstyle::empty_events() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet("/*" + QString::number(i) + "*/"); @@ -112,6 +114,7 @@ void tst_qstylesheetstyle::simple() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); @@ -124,6 +127,7 @@ void tst_qstylesheetstyle::simple_events() { QWidget *w = buildSimpleWidgets(); w->setStyleSheet("/* */"); + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(QString(simple_css) + "/*" + QString::number(i) + "*/"); @@ -175,8 +179,13 @@ void tst_qstylesheetstyle::grid() w->setStyleSheet("/* */"); if(show) { w->show(); + QTest::qWaitForWindowShown(w); + QApplication::flush(); + QApplication::processEvents(); QTest::qWait(30); + QApplication::processEvents(); } + QApplication::processEvents(); int i = 0; QBENCHMARK { w->setStyleSheet(stylesheet + "/*" + QString::number(i) + "*/"); diff --git a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro index 99d1935..89f5d31 100644 --- a/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro +++ b/tests/benchmarks/network/access/qfile_vs_qnetworkaccessmanager/qfile_vs_qnetworkaccessmanager.pro @@ -1,6 +1,6 @@ load(qttest_p4) TEMPLATE = app -TARGET = qfile_vs_qnetworkaccessmanager +TARGET = tst_qfile_vs_qnetworkaccessmanager DEPENDPATH += . INCLUDEPATH += . diff --git a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp index 3bfc21c..d7bb04b 100644 --- a/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp +++ b/tests/benchmarks/script/qscriptvalue/tst_qscriptvalue.cpp @@ -69,6 +69,8 @@ private slots: void property(); void setProperty(); void propertyFlags(); + void readMetaProperty(); + void writeMetaProperty(); }; tst_QScriptValue::tst_QScriptValue() @@ -201,5 +203,28 @@ void tst_QScriptValue::propertyFlags() } } +void tst_QScriptValue::readMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.property(propertyName); + } +} + +void tst_QScriptValue::writeMetaProperty() +{ + QScriptEngine engine; + QScriptValue object = engine.newQObject(QCoreApplication::instance()); + QScriptString propertyName = engine.toStringHandle("objectName"); + QScriptValue value(&engine, "foo"); + QBENCHMARK { + for (int i = 0; i < 10000; ++i) + object.setProperty(propertyName, value); + } +} + QTEST_MAIN(tst_QScriptValue) #include "tst_qscriptvalue.moc" |