summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/auto.pro2
-rw-r--r--tests/auto/declarative/.gitignore3
-rw-r--r--tests/auto/declarative/anchors/anchors.pro5
-rw-r--r--tests/auto/declarative/anchors/data/anchors.qml117
-rw-r--r--tests/auto/declarative/anchors/data/illegal1.qml12
-rw-r--r--tests/auto/declarative/anchors/data/illegal2.qml13
-rw-r--r--tests/auto/declarative/anchors/data/illegal3.qml12
-rw-r--r--tests/auto/declarative/anchors/data/loop1.qml8
-rw-r--r--tests/auto/declarative/anchors/data/loop2.qml20
-rw-r--r--tests/auto/declarative/anchors/tst_anchors.cpp185
-rw-r--r--tests/auto/declarative/animations/animations.pro5
-rw-r--r--tests/auto/declarative/animations/data/badproperty1.qml24
-rw-r--r--tests/auto/declarative/animations/data/badtype1.qml12
-rw-r--r--tests/auto/declarative/animations/data/badtype2.qml12
-rw-r--r--tests/auto/declarative/animations/data/badtype3.qml12
-rw-r--r--tests/auto/declarative/animations/data/badtype4.qml26
-rw-r--r--tests/auto/declarative/animations/data/dotproperty.qml24
-rw-r--r--tests/auto/declarative/animations/data/mixedtype1.qml24
-rw-r--r--tests/auto/declarative/animations/data/mixedtype2.qml24
-rw-r--r--tests/auto/declarative/animations/tst_animations.cpp200
-rw-r--r--tests/auto/declarative/datetimeformatter/datetimeformatter.pro3
-rw-r--r--tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp91
-rw-r--r--tests/auto/declarative/declarative.pro23
-rw-r--r--tests/auto/declarative/layouts/data/grid-spacing.qml40
-rw-r--r--tests/auto/declarative/layouts/data/grid.qml39
-rw-r--r--tests/auto/declarative/layouts/data/horizontal-spacing.qml27
-rw-r--r--tests/auto/declarative/layouts/data/horizontal.qml26
-rw-r--r--tests/auto/declarative/layouts/data/vertical-spacing.qml27
-rw-r--r--tests/auto/declarative/layouts/data/vertical.qml26
-rw-r--r--tests/auto/declarative/layouts/layouts.pro6
-rw-r--r--tests/auto/declarative/layouts/tst_layouts.cpp200
-rw-r--r--tests/auto/declarative/listview/data/listview.qml45
-rw-r--r--tests/auto/declarative/listview/listview.pro6
-rw-r--r--tests/auto/declarative/listview/tst_listview.cpp488
-rw-r--r--tests/auto/declarative/numberformatter/numberformatter.pro3
-rw-r--r--tests/auto/declarative/numberformatter/tst_numberformatter.cpp224
-rw-r--r--tests/auto/declarative/pathview/data/pathview.qml66
-rw-r--r--tests/auto/declarative/pathview/pathview.pro6
-rw-r--r--tests/auto/declarative/pathview/tst_pathview.cpp261
-rw-r--r--tests/auto/declarative/qbindablemap/qbindablemap.pro3
-rw-r--r--tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp74
-rw-r--r--tests/auto/declarative/qfxloader/NoResize.qml7
-rw-r--r--tests/auto/declarative/qfxloader/Rect120x60.qml6
-rw-r--r--tests/auto/declarative/qfxloader/SetSourceComponent.qml6
-rw-r--r--tests/auto/declarative/qfxloader/SizeToItem.qml6
-rw-r--r--tests/auto/declarative/qfxloader/SizeToLoader.qml7
-rw-r--r--tests/auto/declarative/qfxloader/qfxloader.pro5
-rw-r--r--tests/auto/declarative/qfxloader/tst_qfxloader.cpp103
-rw-r--r--tests/auto/declarative/qfxpixmapcache/data/exists.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qfxpixmapcache/data/exists1.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qfxpixmapcache/data/exists2.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro9
-rw-r--r--tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp226
-rw-r--r--tests/auto/declarative/qfxtext/qfxtext.pro3
-rw-r--r--tests/auto/declarative/qfxtext/tst_qfxtext.cpp413
-rw-r--r--tests/auto/declarative/qfxtextedit/data/cursorTest.qml8
-rw-r--r--tests/auto/declarative/qfxtextedit/qfxtextedit.pro3
-rw-r--r--tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp457
-rw-r--r--tests/auto/declarative/qfxtextinput/data/navigation.qml23
-rw-r--r--tests/auto/declarative/qfxtextinput/qfxtextinput.pro6
-rw-r--r--tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp365
-rw-r--r--tests/auto/declarative/qmlbindengine/bindingLoop.txt14
-rw-r--r--tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt5
-rw-r--r--tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt5
-rw-r--r--tests/auto/declarative/qmlbindengine/deferredProperties.txt7
-rw-r--r--tests/auto/declarative/qmlbindengine/enums.1.qml20
-rw-r--r--tests/auto/declarative/qmlbindengine/extensionObjects.txt10
-rw-r--r--tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt13
-rw-r--r--tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt12
-rw-r--r--tests/auto/declarative/qmlbindengine/methods.1.txt6
-rw-r--r--tests/auto/declarative/qmlbindengine/methods.2.txt6
-rw-r--r--tests/auto/declarative/qmlbindengine/qmlbindengine.pro9
-rw-r--r--tests/auto/declarative/qmlbindengine/signalAssignment.1.txt5
-rw-r--r--tests/auto/declarative/qmlbindengine/signalAssignment.2.txt5
-rw-r--r--tests/auto/declarative/qmlbindengine/testtypes.cpp41
-rw-r--r--tests/auto/declarative/qmlbindengine/testtypes.h201
-rw-r--r--tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp390
-rw-r--r--tests/auto/declarative/qmldom/data/MyComponent.qml4
-rw-r--r--tests/auto/declarative/qmldom/data/importdir/Bar.qml2
-rw-r--r--tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml2
-rw-r--r--tests/auto/declarative/qmldom/data/top.qml6
-rw-r--r--tests/auto/declarative/qmldom/qmldom.pro5
-rw-r--r--tests/auto/declarative/qmldom/tst_qmldom.cpp201
-rw-r--r--tests/auto/declarative/qmlengine/functions.qml6
-rw-r--r--tests/auto/declarative/qmlengine/qmlengine.pro5
-rw-r--r--tests/auto/declarative/qmlengine/tst_qmlengine.cpp98
-rw-r--r--tests/auto/declarative/qmllist/qmllist.pro3
-rw-r--r--tests/auto/declarative/qmllist/tst_qmllist.cpp38
-rw-r--r--tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro3
-rw-r--r--tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp61
-rw-r--r--tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro3
-rw-r--r--tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp104
-rw-r--r--tests/auto/declarative/qmlparser/Alias.qml8
-rw-r--r--tests/auto/declarative/qmlparser/MyComponent.qml6
-rw-r--r--tests/auto/declarative/qmlparser/MyContainerComponent.qml5
-rw-r--r--tests/auto/declarative/qmlparser/alias.1.qml8
-rw-r--r--tests/auto/declarative/qmlparser/alias.2.qml8
-rw-r--r--tests/auto/declarative/qmlparser/alias.3.qml10
-rw-r--r--tests/auto/declarative/qmlparser/assignBasicTypes.qml26
-rw-r--r--tests/auto/declarative/qmlparser/assignLiteralSignalProperty.qml4
-rw-r--r--tests/auto/declarative/qmlparser/assignObjectToSignal.qml4
-rw-r--r--tests/auto/declarative/qmlparser/assignObjectToVariant.qml6
-rw-r--r--tests/auto/declarative/qmlparser/assignQmlComponent.qml4
-rw-r--r--tests/auto/declarative/qmlparser/assignSignal.qml4
-rw-r--r--tests/auto/declarative/qmlparser/assignTypeExtremes.qml5
-rw-r--r--tests/auto/declarative/qmlparser/attachedProperties.qml5
-rw-r--r--tests/auto/declarative/qmlparser/autoComponentCreation.qml4
-rw-r--r--tests/auto/declarative/qmlparser/cppnamespace.qml4
-rw-r--r--tests/auto/declarative/qmlparser/customParserIdNotAllowed.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/customParserIdNotAllowed.qml5
-rw-r--r--tests/auto/declarative/qmlparser/customParserTypes.qml5
-rw-r--r--tests/auto/declarative/qmlparser/customVariantTypes.qml4
-rw-r--r--tests/auto/declarative/qmlparser/duplicateIDs.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/duplicateIDs.qml6
-rw-r--r--tests/auto/declarative/qmlparser/dynamicObject.1.qml8
-rw-r--r--tests/auto/declarative/qmlparser/dynamicProperties.qml13
-rw-r--r--tests/auto/declarative/qmlparser/dynamicSignalsAndSlots.qml7
-rw-r--r--tests/auto/declarative/qmlparser/empty.errors.txt2
-rw-r--r--tests/auto/declarative/qmlparser/empty.qml0
-rw-r--r--tests/auto/declarative/qmlparser/failingComponent.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/failingComponentTest.qml4
-rw-r--r--tests/auto/declarative/qmlparser/fakeDotProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/fakeDotProperty.qml4
-rw-r--r--tests/auto/declarative/qmlparser/finalOverride.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/finalOverride.qml4
-rw-r--r--tests/auto/declarative/qmlparser/idProperty.qml8
-rw-r--r--tests/auto/declarative/qmlparser/importNamespaceConflict.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/importNamespaceConflict.qml4
-rw-r--r--tests/auto/declarative/qmlparser/inlineQmlComponents.qml10
-rw-r--r--tests/auto/declarative/qmlparser/interfaceProperty.qml5
-rw-r--r--tests/auto/declarative/qmlparser/interfaceQList.qml7
-rw-r--r--tests/auto/declarative/qmlparser/interfaceQmlList.qml7
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.2.qml5
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.3.qml5
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.4.qml6
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.5.qml6
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.6.qml5
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/invalidID.qml4
-rw-r--r--tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest.qml2
-rw-r--r--tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest2.qml2
-rw-r--r--tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/qmldir3
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.1.qml4
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.2.errors.txt2
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.2.qml4
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/listAssignment.3.qml6
-rw-r--r--tests/auto/declarative/qmlparser/listItemDeleteSelf.qml38
-rw-r--r--tests/auto/declarative/qmlparser/missingObject.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/missingObject.qml1
-rw-r--r--tests/auto/declarative/qmlparser/missingSignal.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/missingSignal.qml5
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.1.qml2
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.2.qml4
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.3.qml4
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.4.qml4
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.5.qml4
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nonexistantProperty.6.qml4
-rw-r--r--tests/auto/declarative/qmlparser/nullDotProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/nullDotProperty.qml4
-rw-r--r--tests/auto/declarative/qmlparser/propertyValueSource.qml4
-rw-r--r--tests/auto/declarative/qmlparser/qmlparser.pro9
-rw-r--r--tests/auto/declarative/qmlparser/readOnly.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/readOnly.1.qml4
-rw-r--r--tests/auto/declarative/qmlparser/readOnly.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/readOnly.2.qml4
-rw-r--r--tests/auto/declarative/qmlparser/rootAsQmlComponent.qml6
-rw-r--r--tests/auto/declarative/qmlparser/simpleBindings.qml18
-rw-r--r--tests/auto/declarative/qmlparser/simpleContainer.qml5
-rw-r--r--tests/auto/declarative/qmlparser/simpleObject.qml2
-rw-r--r--tests/auto/declarative/qmlparser/subdir/Test.qml2
-rw-r--r--tests/auto/declarative/qmlparser/testtypes.cpp10
-rw-r--r--tests/auto/declarative/qmlparser/testtypes.h431
-rw-r--r--tests/auto/declarative/qmlparser/tst_qmlparser.cpp853
-rw-r--r--tests/auto/declarative/qmlparser/unregisteredObject.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/unregisteredObject.qml2
-rw-r--r--tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/unsupportedProperty.qml4
-rw-r--r--tests/auto/declarative/qmlparser/valueTypes.qml13
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.1.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.1.qml4
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.10.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.10.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.11.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.11.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.12.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.12.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.13.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.13.qml4
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.14.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.14.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.2.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.2.qml4
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.3.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.3.qml4
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.4.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.4.qml4
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.5.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.5.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.6.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.6.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.7.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.7.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.8.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.8.qml5
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.9.errors.txt1
-rw-r--r--tests/auto/declarative/qmlparser/wrongType.9.qml5
-rw-r--r--tests/auto/declarative/repeater/data/repeater.qml22
-rw-r--r--tests/auto/declarative/repeater/repeater.pro6
-rw-r--r--tests/auto/declarative/repeater/tst_repeater.cpp91
-rw-r--r--tests/auto/declarative/sql/data/test1.js18
-rw-r--r--tests/auto/declarative/sql/tst_sql.cpp108
-rw-r--r--tests/auto/declarative/states/data/basicBinding.qml12
-rw-r--r--tests/auto/declarative/states/data/basicBinding2.qml12
-rw-r--r--tests/auto/declarative/states/data/basicBinding3.qml13
-rw-r--r--tests/auto/declarative/states/data/basicBinding4.qml17
-rw-r--r--tests/auto/declarative/states/data/basicChanges.qml10
-rw-r--r--tests/auto/declarative/states/data/basicChanges2.qml15
-rw-r--r--tests/auto/declarative/states/data/basicChanges3.qml15
-rw-r--r--tests/auto/declarative/states/data/basicExtension.qml16
-rw-r--r--tests/auto/declarative/states/data/fakeExtension.qml16
-rw-r--r--tests/auto/declarative/states/states.pro6
-rw-r--r--tests/auto/declarative/states/tst_states.cpp267
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/basic1.qml27
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/data/raster/image0.pngbin0 -> 1737 bytes
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/ListView/basic1/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/basic2.qml31
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/data/raster/image0.pngbin0 -> 1737 bytes
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/ListView/basic2/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/basic3.qml29
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/data/raster/image0.pngbin0 -> 1737 bytes
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/ListView/basic3/test1
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/basic4.qml33
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/data/raster/image0.pngbin0 -> 1737 bytes
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/ListView/basic4/test1
-rw-r--r--tests/auto/declarative/visual/bindinganimation/bindinganimation.qml40
-rw-r--r--tests/auto/declarative/visual/bindinganimation/data/raster/image0.pngbin0 -> 817 bytes
-rw-r--r--tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml88
-rw-r--r--tests/auto/declarative/visual/bindinganimation/test1
-rw-r--r--tests/auto/declarative/visual/colorAnimation/colorAnimation.qml41
-rw-r--r--tests/auto/declarative/visual/colorAnimation/data/raster/image0.pngbin0 -> 607 bytes
-rw-r--r--tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml524
-rw-r--r--tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml522
-rw-r--r--tests/auto/declarative/visual/colorAnimation/manifest-play.xml73
-rw-r--r--tests/auto/declarative/visual/easing/easing.qml186
-rw-r--r--tests/auto/declarative/visual/easing/image0.pngbin0 -> 17530 bytes
-rw-r--r--tests/auto/declarative/visual/easing/manifest-play.xml23
-rw-r--r--tests/auto/declarative/visual/easing/manifest.xml23
-rw-r--r--tests/auto/declarative/visual/easing/pics/qtlogo.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/visual/flickable/Day.qml27
-rw-r--r--tests/auto/declarative/visual/flickable/cork.jpgbin0 -> 22211 bytes
-rw-r--r--tests/auto/declarative/visual/flickable/flickable.qml55
-rw-r--r--tests/auto/declarative/visual/flipable/flipable.xml138
-rw-r--r--tests/auto/declarative/visual/flipable/image0.pngbin0 -> 6184 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/manifest-play.xml24
-rw-r--r--tests/auto/declarative/visual/flipable/manifest.xml24
-rw-r--r--tests/auto/declarative/visual/flipable/pics/arrow.pngbin0 -> 546 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/face.pngbin0 -> 10112 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo0.pngbin0 -> 10412 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo1.pngbin0 -> 11068 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo10.pngbin0 -> 12539 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo2.pngbin0 -> 11490 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo3.pngbin0 -> 11308 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo4.pngbin0 -> 11322 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo5.pngbin0 -> 11497 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo6.pngbin0 -> 11707 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo7.pngbin0 -> 11101 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo8.pngbin0 -> 11558 bytes
-rw-r--r--tests/auto/declarative/visual/flipable/pics/photo9.pngbin0 -> 10943 bytes
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/data/raster/image0.pngbin0 -> 3209 bytes
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/data/raster/manifest.qml1264
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml30
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/pics/qtlogo.pngbin0 -> 2738 bytes
-rw-r--r--tests/auto/declarative/visual/pauseAnimation/test1
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.pngbin0 -> 909 bytes
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/elide.qml35
-rw-r--r--tests/auto/declarative/visual/qfxtext/elide/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/basic1.qml28
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/data/raster/image0.pngbin0 -> 1287 bytes
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/repeater/basic1/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/basic2.qml32
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/data/raster/image0.pngbin0 -> 1287 bytes
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/repeater/basic2/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/basic3.qml30
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/data/raster/image0.pngbin0 -> 1287 bytes
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml15
-rw-r--r--tests/auto/declarative/visual/repeater/basic3/test1
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/basic4.qml34
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/data/raster/image0.pngbin0 -> 1287 bytes
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/repeater/basic4/test1
-rwxr-xr-xtests/auto/declarative/visual/runtests.sh3
-rw-r--r--tests/auto/declarative/visual/tests12
-rw-r--r--tests/auto/declarative/visual/tst_visual.cpp74
-rw-r--r--tests/auto/declarative/visual/visual.pro5
-rw-r--r--tests/auto/declarative/visual/webview/autosize/data/raster/image0.pngbin0 -> 4820 bytes
-rw-r--r--tests/auto/declarative/visual/webview/autosize/data/raster/manifest.qml8
-rw-r--r--tests/auto/declarative/visual/webview/autosize/test1
-rw-r--r--tests/benchmarks/benchmarks.pro10
-rw-r--r--tests/benchmarks/declarative/binding/binding.pro8
-rw-r--r--tests/benchmarks/declarative/binding/idproperty.txt7
-rw-r--r--tests/benchmarks/declarative/binding/localproperty.txt3
-rw-r--r--tests/benchmarks/declarative/binding/objectproperty.txt5
-rw-r--r--tests/benchmarks/declarative/binding/testtypes.cpp3
-rw-r--r--tests/benchmarks/declarative/binding/testtypes.h41
-rw-r--r--tests/benchmarks/declarative/binding/tst_binding.cpp126
-rw-r--r--tests/benchmarks/declarative/pointers/pointers.pro6
-rw-r--r--tests/benchmarks/declarative/pointers/tst_pointers.cpp43
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/myqmlobject.txt3
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/myqmlobject_binding.txt6
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/object.txt3
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/object_id.txt6
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro8
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/BoomBlock.qml54
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStar.pngbin0 -> 278 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStone.pngbin0 -> 2691 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStar.pngbin0 -> 273 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStone.pngbin0 -> 2662 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStar.pngbin0 -> 274 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStone.pngbin0 -> 2604 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/samegame/pics/yellowStone.pngbin0 -> 2667 bytes
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt15
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt5
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/testtypes.cpp3
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/testtypes.h41
-rw-r--r--tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp84
-rw-r--r--tests/benchmarks/declarative/qmlmetaproperty/object.txt3
-rw-r--r--tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro7
-rw-r--r--tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt6
-rw-r--r--tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp79
-rw-r--r--tests/benchmarks/qmlpainting/qmlpainting.pro5
-rw-r--r--tests/benchmarks/qmlpainting/tst_qmlpainting.cpp696
351 files changed, 12652 insertions, 1 deletions
diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro
index e2a67af..3df24ac 100644
--- a/tests/auto/auto.pro
+++ b/tests/auto/auto.pro
@@ -493,3 +493,5 @@ contains(QT_CONFIG, webkit): SUBDIRS += \
qwebhistoryinterface \
qwebelement \
qwebhistory
+
+contains(QT_CONFIG, declarative): SUBDIRS += declarative
diff --git a/tests/auto/declarative/.gitignore b/tests/auto/declarative/.gitignore
new file mode 100644
index 0000000..c8bbd2f
--- /dev/null
+++ b/tests/auto/declarative/.gitignore
@@ -0,0 +1,3 @@
+tst_*
+!tst_*.*
+tst_*~
diff --git a/tests/auto/declarative/anchors/anchors.pro b/tests/auto/declarative/anchors/anchors.pro
new file mode 100644
index 0000000..7b22cfb
--- /dev/null
+++ b/tests/auto/declarative/anchors/anchors.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_anchors.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/anchors/data/anchors.qml b/tests/auto/declarative/anchors/data/anchors.qml
new file mode 100644
index 0000000..122d440
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/anchors.qml
@@ -0,0 +1,117 @@
+import Qt 4.6
+
+Rect {
+ color: "white"
+ width: 240
+ height: 320
+ Rect { id: MasterRect; x: 26; width: 96; height: 20; color: "red" }
+ Rect {
+ id: Rect1
+ y: 20; width: 10; height: 10
+ anchors.left: MasterRect.left
+ }
+ Rect {
+ id: Rect2
+ y: 20; width: 10; height: 10
+ anchors.left: MasterRect.right
+ }
+ Rect {
+ id: Rect3
+ y: 20; width: 10; height: 10
+ anchors.left: MasterRect.horizontalCenter
+ }
+ Rect {
+ id: Rect4
+ y: 30; width: 10; height: 10
+ anchors.right: MasterRect.left
+ }
+ Rect {
+ id: Rect5
+ y: 30; width: 10; height: 10
+ anchors.right: MasterRect.right
+ }
+ Rect {
+ id: Rect6
+ y: 30; width: 10; height: 10
+ anchors.right: MasterRect.horizontalCenter
+ }
+ Rect {
+ id: Rect7
+ y: 50; width: 10; height: 10
+ anchors.left: parent.left
+ }
+ Rect {
+ id: Rect8
+ y: 50; width: 10; height: 10
+ anchors.left: parent.right
+ }
+ Rect {
+ id: Rect9
+ y: 50; width: 10; height: 10
+ anchors.left: parent.horizontalCenter
+ }
+ Rect {
+ id: Rect10
+ y: 60; width: 10; height: 10
+ anchors.right: parent.left
+ }
+ Rect {
+ id: Rect11
+ y: 60; width: 10; height: 10
+ anchors.right: parent.right
+ }
+ Rect {
+ id: Rect12
+ y: 60; width: 10; height: 10
+ anchors.right: parent.horizontalCenter
+ }
+ Rect {
+ id: Rect13
+ x: 200; width: 10; height: 10
+ anchors.top: MasterRect.bottom
+ }
+ Rect {
+ id: Rect14
+ width: 10; height: 10; color: "steelblue"
+ anchors.verticalCenter: parent.verticalCenter
+ }
+ Rect {
+ id: Rect15
+ y: 200; height: 10
+ anchors.left: MasterRect.left
+ anchors.right: MasterRect.right
+ }
+ Rect {
+ id: Rect16
+ y: 220; height: 10
+ anchors.left: MasterRect.left
+ anchors.horizontalCenter: MasterRect.right
+ }
+ Rect {
+ id: Rect17
+ y: 240; height: 10
+ anchors.right: MasterRect.right
+ anchors.horizontalCenter: MasterRect.left
+ }
+ Rect {
+ id: Rect18
+ x: 180; width: 10
+ anchors.top: MasterRect.bottom
+ anchors.bottom: Rect12.top
+ }
+ Rect {
+ id: Rect19
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.horizontalCenter
+ }
+ Rect {
+ id: Rect20
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.right
+ }
+ Rect {
+ id: Rect21
+ y: 70; width: 10; height: 10
+ anchors.horizontalCenter: parent.left
+ }
+}
diff --git a/tests/auto/declarative/anchors/data/illegal1.qml b/tests/auto/declarative/anchors/data/illegal1.qml
new file mode 100644
index 0000000..1d23110
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/illegal1.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rect {
+ id: rect
+ width: 120; height: 200; color: "white"
+ Rect { id: TheRect; width: 100; height: 100 }
+ Rect {
+ anchors.left: TheRect.left
+ anchors.right: TheRect.right
+ anchors.horizontalCenter: TheRect.horizontalCenter
+ }
+}
diff --git a/tests/auto/declarative/anchors/data/illegal2.qml b/tests/auto/declarative/anchors/data/illegal2.qml
new file mode 100644
index 0000000..9f81b91
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/illegal2.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+
+Rect {
+ id: rect
+ width: 120; height: 200; color: "white"
+ Text { id: Text1; text: "Hello" }
+ Text {
+ id: Text2;
+ anchors.baseline: Text1.baseline;
+ anchors.top: Text1.top;
+ text: "World"
+ }
+}
diff --git a/tests/auto/declarative/anchors/data/illegal3.qml b/tests/auto/declarative/anchors/data/illegal3.qml
new file mode 100644
index 0000000..4f07456
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/illegal3.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rect {
+ id: rect
+ width: 120; height: 200; color: "white"
+ Item {
+ Rect { id: TheRect; width: 100; height: 100 }
+ }
+ Rect {
+ anchors.left: TheRect.left
+ }
+}
diff --git a/tests/auto/declarative/anchors/data/loop1.qml b/tests/auto/declarative/anchors/data/loop1.qml
new file mode 100644
index 0000000..adc5a10
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/loop1.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Rect {
+ id: rect
+ width: 120; height: 200; color: "white"
+ Text { id: Text1; anchors.right: Text2.right; text: "Hello" }
+ Text { id: Text2; anchors.right: Text1.right; anchors.rightMargin: 10; text: "World" }
+}
diff --git a/tests/auto/declarative/anchors/data/loop2.qml b/tests/auto/declarative/anchors/data/loop2.qml
new file mode 100644
index 0000000..a6856f8
--- /dev/null
+++ b/tests/auto/declarative/anchors/data/loop2.qml
@@ -0,0 +1,20 @@
+import Qt 4.6
+
+Rect {
+ id: container;
+ width: 600;
+ height: 600;
+
+ Image {
+ id: Image1
+ source: "http://labs.trolltech.com/blogs/wp-content/uploads/2009/03/3311388091_ac2a257feb.jpg"
+ anchors.right: Image2.left
+ }
+
+ Image {
+ id: Image2
+ source: "http://labs.trolltech.com/blogs/wp-content/uploads/2009/03/oslo_groupphoto.jpg"
+ anchors.left: Image1.right
+ anchors.leftMargin: 20
+ }
+}
diff --git a/tests/auto/declarative/anchors/tst_anchors.cpp b/tests/auto/declarative/anchors/tst_anchors.cpp
new file mode 100644
index 0000000..98ede65
--- /dev/null
+++ b/tests/auto/declarative/anchors/tst_anchors.cpp
@@ -0,0 +1,185 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxview.h>
+#include <QtDeclarative/qfxrect.h>
+
+class tst_anchors : public QObject
+{
+ Q_OBJECT
+public:
+ tst_anchors() {}
+
+ template<typename T>
+ T *findItem(QFxItem *parent, const QString &id);
+
+private slots:
+ void basicAnchors();
+ void loops();
+ void illegalSets();
+ void reset();
+ void nullItem();
+};
+
+/*
+ Find an item with the specified id.
+*/
+template<typename T>
+T *tst_anchors::findItem(QFxItem *parent, const QString &objectName)
+{
+ const QMetaObject &mo = T::staticMetaObject;
+ for (int i = 0; i < parent->QSimpleCanvasItem::children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->QSimpleCanvasItem::children().at(i));
+ 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_anchors::basicAnchors()
+{
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/anchors.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ //sibling horizontal
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect1"))->x(), 26.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect2"))->x(), 122.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect3"))->x(), 74.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect4"))->x(), 16.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect5"))->x(), 112.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect6"))->x(), 64.0);
+
+ //parent horizontal
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect7"))->x(), 0.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect8"))->x(), 240.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect9"))->x(), 120.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect10"))->x(), -10.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect11"))->x(), 230.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect12"))->x(), 110.0);
+
+ //vertical
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect13"))->y(), 20.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect14"))->y(), 155.0);
+
+ //stretch
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect15"))->x(), 26.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect15"))->width(), 96.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect16"))->x(), 26.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect16"))->width(), 192.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect17"))->x(), -70.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect17"))->width(), 192.0);
+
+ //vertical stretch
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect18"))->y(), 20.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect18"))->height(), 40.0);
+
+ //more parent horizontal
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect19"))->x(), 115.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect20"))->x(), 235.0);
+ QCOMPARE(findItem<QFxRect>(view->root(), QLatin1String("Rect21"))->x(), -5.0);
+
+ delete view;
+}
+
+// mostly testing that we don't crash
+void tst_anchors::loops()
+{
+ {
+ QFxView *view = new QFxView;
+
+ view->setUrl(QUrl("file://" SRCDIR "/data/loop1.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Possible anchor loop detected on horizontal anchor. "); //x5
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ {
+ QFxView *view = new QFxView;
+
+ view->setUrl(QUrl("file://" SRCDIR "/data/loop2.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxImage (unknown location): Possible anchor loop detected on horizontal anchor. "); //x3
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+}
+
+void tst_anchors::illegalSets()
+{
+ {
+ QFxView *view = new QFxView;
+
+ view->setUrl(QUrl("file://" SRCDIR "/data/illegal1.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't specify left, right, and hcenter anchors. ");
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ {
+ QFxView *view = new QFxView;
+
+ view->setUrl(QUrl("file://" SRCDIR "/data/illegal2.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxText (unknown location): Baseline anchor can't be used in conjunction with top, bottom, or vcenter anchors. ");
+ view->execute();
+ //qApp->processEvents();
+
+ delete view;
+ }
+
+ {
+ QFxView *view = new QFxView;
+
+ view->setUrl(QUrl("file://" SRCDIR "/data/illegal3.qml"));
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxRect (unknown location): Can't anchor to an item that isn't a parent or sibling. ");
+ view->execute();
+ //qApp->processEvents();
+
+ delete view;
+ }
+}
+
+void tst_anchors::reset()
+{
+ QFxItem *aItem = new QFxItem;
+ QFxAnchorLine anchor;
+ anchor.item = aItem;
+ anchor.anchorLine = QFxAnchorLine::Top;
+
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), true);
+
+ item->anchors()->resetBottom();
+ QCOMPARE(item->anchors()->usedAnchors().testFlag(QFxAnchors::HasBottomAnchor), false);
+}
+
+void tst_anchors::nullItem()
+{
+ QFxAnchorLine anchor;
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QFxItem (unknown location): Can't anchor to a null item. ");
+ QFxItem *item = new QFxItem;
+ item->anchors()->setBottom(anchor);
+}
+
+QTEST_MAIN(tst_anchors)
+
+#include "tst_anchors.moc"
diff --git a/tests/auto/declarative/animations/animations.pro b/tests/auto/declarative/animations/animations.pro
new file mode 100644
index 0000000..419da4e
--- /dev/null
+++ b/tests/auto/declarative/animations/animations.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_animations.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/animations/data/badproperty1.qml b/tests/auto/declarative/animations/data/badproperty1.qml
new file mode 100644
index 0000000..a01753e
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badproperty1.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Rectangle {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: MyRect; pen.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { target: MyRect; to: "red"; properties: "pen.colr"; duration: 1000 }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype1.qml b/tests/auto/declarative/animations/data/badtype1.qml
new file mode 100644
index 0000000..1e689d5
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype1.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: PropertyAnimation { from: "blue"; to: "green"; running: true; }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype2.qml b/tests/auto/declarative/animations/data/badtype2.qml
new file mode 100644
index 0000000..e97194d
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype2.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ x: NumberAnimation { from: "blue"; to: "green"; running: true; }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype3.qml b/tests/auto/declarative/animations/data/badtype3.qml
new file mode 100644
index 0000000..b2d738f
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype3.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+
+Rectangle {
+ width: 240
+ height: 320
+ Rectangle {
+ color: "red"
+ color: ColorAnimation { from: 10; to: 15; running: true; }
+ width: 50; height: 50
+ x: 100; y: 100
+ }
+}
diff --git a/tests/auto/declarative/animations/data/badtype4.qml b/tests/auto/declarative/animations/data/badtype4.qml
new file mode 100644
index 0000000..0c0a636
--- /dev/null
+++ b/tests/auto/declarative/animations/data/badtype4.qml
@@ -0,0 +1,26 @@
+import Qt 4.6
+
+Rectangle {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: MyRect; x: 200; color: "blue" }
+ }
+ transitions: Transition {
+ //comment out each in turn to make sure each only animates the relevant property
+ ColorAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ NumberAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ }
+}
diff --git a/tests/auto/declarative/animations/data/dotproperty.qml b/tests/auto/declarative/animations/data/dotproperty.qml
new file mode 100644
index 0000000..ee076c2
--- /dev/null
+++ b/tests/auto/declarative/animations/data/dotproperty.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Rectangle {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: MyRect; pen.color: "blue" }
+ }
+ transitions: Transition {
+ ColorAnimation { properties: "pen.color"; duration: 1000 }
+ }
+}
diff --git a/tests/auto/declarative/animations/data/mixedtype1.qml b/tests/auto/declarative/animations/data/mixedtype1.qml
new file mode 100644
index 0000000..ed50582
--- /dev/null
+++ b/tests/auto/declarative/animations/data/mixedtype1.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Rectangle {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: MyRect; x: 200; border.width: 10 }
+ }
+ transitions: Transition {
+ PropertyAnimation { properties: "x,border.width"; duration: 1000 } //x is real, border.width is int
+ }
+}
diff --git a/tests/auto/declarative/animations/data/mixedtype2.qml b/tests/auto/declarative/animations/data/mixedtype2.qml
new file mode 100644
index 0000000..4854c2e
--- /dev/null
+++ b/tests/auto/declarative/animations/data/mixedtype2.qml
@@ -0,0 +1,24 @@
+import Qt 4.6
+
+Rectangle {
+ id: Wrapper
+ width: 240
+ height: 320
+ Rectangle {
+ id: MyRect
+ color: "red"
+ width: 50; height: 50
+ x: 100; y: 100
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: if (Wrapper.state == "state1") Wrapper.state = ""; else Wrapper.state = "state1";
+ }
+ }
+ states: State {
+ name: "state1"
+ PropertyChanges { target: MyRect; x: 200; color: "blue" }
+ }
+ transitions: Transition {
+ PropertyAnimation { properties: "x,color"; duration: 1000 } //x is real, color is color
+ }
+}
diff --git a/tests/auto/declarative/animations/tst_animations.cpp b/tests/auto/declarative/animations/tst_animations.cpp
new file mode 100644
index 0000000..8e1abc6
--- /dev/null
+++ b/tests/auto/declarative/animations/tst_animations.cpp
@@ -0,0 +1,200 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxview.h>
+#include <QtDeclarative/qfxrect.h>
+#include <QtDeclarative/QmlNumberAnimation>
+
+class tst_animations : public QObject
+{
+ Q_OBJECT
+public:
+ tst_animations() {}
+
+private slots:
+ void simpleNumber();
+ void simpleColor();
+ void alwaysRunToEnd();
+ void dotProperty();
+ void badTypes();
+ void badProperties();
+ void mixedTypes();
+};
+
+void tst_animations::simpleNumber()
+{
+ QFxRect rect;
+ QmlNumberAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.start();
+ QTest::qWait(animation.duration() + 50);
+ QCOMPARE(rect.x(), qreal(200));
+
+ rect.setX(0);
+ animation.start();
+ animation.pause();
+ animation.setCurrentTime(125);
+ QCOMPARE(rect.x(), qreal(100));
+}
+
+void tst_animations::simpleColor()
+{
+ QFxRect rect;
+ QmlColorAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("color");
+ animation.setTo(QColor("red"));
+ animation.start();
+ QTest::qWait(animation.duration() + 50);
+ QCOMPARE(rect.color(), QColor("red"));
+
+ rect.setColor(QColor("blue"));
+ animation.start();
+ animation.pause();
+ animation.setCurrentTime(125);
+ QCOMPARE(rect.color(), QColor::fromRgbF(0.498039, 0, 0.498039, 1));
+}
+
+void tst_animations::alwaysRunToEnd()
+{
+ QFxRect rect;
+ QmlPropertyAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("x");
+ animation.setTo(200);
+ animation.setDuration(1000);
+ animation.setRepeat(true);
+ animation.setAlwaysRunToEnd(true);
+ animation.start();
+ QTest::qWait(1500);
+ animation.stop();
+ QVERIFY(rect.x() != qreal(200));
+ QTest::qWait(500 + 50);
+ QCOMPARE(rect.x(), qreal(200));
+}
+
+void tst_animations::dotProperty()
+{
+ QFxRect rect;
+ QmlNumberAnimation animation;
+ animation.setTarget(&rect);
+ animation.setProperty("border.width");
+ animation.setTo(10);
+ animation.start();
+ QTest::qWait(animation.duration() + 50);
+ QCOMPARE(rect.border()->width(), 10);
+
+ rect.border()->setWidth(1);
+ animation.start();
+ animation.pause();
+ animation.setCurrentTime(125);
+ QCOMPARE(rect.border()->width(), 5);
+}
+
+void tst_animations::badTypes()
+{
+ //don't crash
+ {
+ QFxView *view = new QFxView;
+ view->setUrl(QUrl("file://" SRCDIR "/data/badtype1.qml"));
+
+ view->execute();
+ qApp->processEvents();
+
+ delete view;
+ }
+
+ //make sure we get a compiler error
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" 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("file://" 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("file://" SRCDIR "/data/badtype4.qml"));
+ QFxRect *rect = qobject_cast<QFxRect*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("state1");
+ QTest::qWait(1000 + 50);
+ QFxRect *myRect = qobject_cast<QFxRect*>(rect->QGraphicsObject::children().at(3)); //### not robust
+ QVERIFY(myRect);
+ QCOMPARE(myRect->x(),qreal(200));
+ }
+}
+
+void tst_animations::badProperties()
+{
+ //make sure we get a runtime error
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/badproperty1.qml"));
+ QFxRect *rect = qobject_cast<QFxRect*>(c.create());
+ QVERIFY(rect);
+
+ QTest::ignoreMessage(QtWarningMsg, "QML QmlColorAnimation (file://" SRCDIR "/data/badproperty1.qml:22:9) Cannot animate non-existant property \"pen.colr\" ");
+ rect->setState("state1");
+ }
+}
+
+//test animating mixed types with property animation in a transition
+//for example, int + real; color + real; etc
+void tst_animations::mixedTypes()
+{
+ //assumes border.width stats a real -- not real robust
+ {
+ QmlEngine engine;
+ QmlComponent c(&engine, QUrl("file://" SRCDIR "/data/mixedtype1.qml"));
+ QFxRect *rect = qobject_cast<QFxRect*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("state1");
+ QTest::qWait(500);
+ QFxRect *myRect = qobject_cast<QFxRect*>(rect->QGraphicsObject::children().at(3)); //### not robust
+ 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("file://" SRCDIR "/data/mixedtype2.qml"));
+ QFxRect *rect = qobject_cast<QFxRect*>(c.create());
+ QVERIFY(rect);
+
+ rect->setState("state1");
+ QTest::qWait(500);
+ QFxRect *myRect = qobject_cast<QFxRect*>(rect->QGraphicsObject::children().at(3)); //### not robust
+ 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"));
+ }
+}
+
+QTEST_MAIN(tst_animations)
+
+#include "tst_animations.moc"
diff --git a/tests/auto/declarative/datetimeformatter/datetimeformatter.pro b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro
new file mode 100644
index 0000000..e3d6cd0
--- /dev/null
+++ b/tests/auto/declarative/datetimeformatter/datetimeformatter.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_datetimeformatter.cpp
diff --git a/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp
new file mode 100644
index 0000000..556912e
--- /dev/null
+++ b/tests/auto/declarative/datetimeformatter/tst_datetimeformatter.cpp
@@ -0,0 +1,91 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmldatetimeformatter.h>
+#include <QDebug>
+
+class tst_datetimeformatter : public QObject
+{
+ Q_OBJECT
+public:
+ tst_datetimeformatter() {}
+
+private slots:
+ void date();
+ void time();
+ void dateTime();
+};
+
+void tst_datetimeformatter::date()
+{
+ QmlEngine engine;
+ QmlComponent formatterComponent(&engine, QByteArray("import Qt 4.6\n DateTimeFormatter { date: \"2008-12-24\" }"),
+ QUrl("file://"));
+ QmlDateTimeFormatter *formatter = qobject_cast<QmlDateTimeFormatter*>(formatterComponent.create());
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatter != 0);
+
+ QDate date(2008,12,24);
+ QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleShortDate));
+
+ formatter->setLongStyle(true);
+ QCOMPARE(formatter->dateText(),date.toString(Qt::SystemLocaleLongDate));
+
+ formatter->setDateFormat("ddd MMMM d yy");
+ QCOMPARE(formatter->dateText(),date.toString("ddd MMMM d yy"));
+
+ QVERIFY(formatter->timeText().isEmpty());
+ QVERIFY(formatter->dateTimeText().isEmpty());
+}
+
+void tst_datetimeformatter::time()
+{
+ QmlEngine engine;
+ QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { time: \"14:15:38.200\" }", QUrl("file://"));
+ 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->timeText(),time.toString(Qt::SystemLocaleShortDate));
+
+ formatter->setLongStyle(true);
+ QCOMPARE(formatter->timeText(),time.toString(Qt::SystemLocaleLongDate));
+
+ formatter->setTimeFormat("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());
+}
+
+void tst_datetimeformatter::dateTime()
+{
+ QmlEngine engine;
+ QmlComponent formatterComponent(&engine, "import Qt 4.6\n DateTimeFormatter { dateTime: \"1978-03-04T09:13:54\" }", QUrl("file://"));
+ 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->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->dateTimeText(),dateTime.toString("M/d/yy H:m:s a"));
+}
+
+QTEST_MAIN(tst_datetimeformatter)
+
+#include "tst_datetimeformatter.moc"
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
new file mode 100644
index 0000000..14d8c24
--- /dev/null
+++ b/tests/auto/declarative/declarative.pro
@@ -0,0 +1,23 @@
+TEMPLATE = subdirs
+SUBDIRS += datetimeformatter \
+ numberformatter \
+ qbindablemap \
+ layouts \
+ listview \
+ pathview \
+ qfxtext \
+ qfxtextedit \
+ simplecanvasitem \
+ repeater \
+ qmlparser \
+ qmlbindengine \
+ qmlmetaproperty \
+ qmllist \
+ qmllistaccessor \
+ visual\
+ qmlengine
+
+# Tests which should run in Pulse
+PULSE_TESTS = $$SUBDIRS
+PULSE_TESTS -= visual # All except 'visual' tests, allegedly too flaky
+
diff --git a/tests/auto/declarative/layouts/data/grid-spacing.qml b/tests/auto/declarative/layouts/data/grid-spacing.qml
new file mode 100644
index 0000000..5b4a30d
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/grid-spacing.qml
@@ -0,0 +1,40 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ columns: 3
+ spacing: 4
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "green"
+ width: 20
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ color: "blue"
+ width: 50
+ height: 20
+ }
+ Rectangle {
+ objectName: "four"
+ color: "cyan"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "five"
+ color: "magenta"
+ width: 10
+ height: 10
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/data/grid.qml b/tests/auto/declarative/layouts/data/grid.qml
new file mode 100644
index 0000000..830df6a
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/grid.qml
@@ -0,0 +1,39 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Grid {
+ columns: 3
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "green"
+ width: 20
+ height: 50
+ }
+ Rectangle {
+ objectName: "three"
+ color: "blue"
+ width: 50
+ height: 20
+ }
+ Rectangle {
+ objectName: "four"
+ color: "cyan"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "five"
+ color: "magenta"
+ width: 10
+ height: 10
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/data/horizontal-spacing.qml b/tests/auto/declarative/layouts/data/horizontal-spacing.qml
new file mode 100644
index 0000000..32bf775
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/horizontal-spacing.qml
@@ -0,0 +1,27 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Row {
+ spacing: 10
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "red"
+ width: 20
+ height: 10
+ }
+ Rectangle {
+ objectName: "three"
+ color: "red"
+ width: 40
+ height: 20
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/data/horizontal.qml b/tests/auto/declarative/layouts/data/horizontal.qml
new file mode 100644
index 0000000..06ae151
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/horizontal.qml
@@ -0,0 +1,26 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Row {
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "red"
+ width: 20
+ height: 10
+ }
+ Rectangle {
+ objectName: "three"
+ color: "red"
+ width: 40
+ height: 20
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/data/vertical-spacing.qml b/tests/auto/declarative/layouts/data/vertical-spacing.qml
new file mode 100644
index 0000000..69a8256
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/vertical-spacing.qml
@@ -0,0 +1,27 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Column {
+ spacing: 10
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "red"
+ width: 20
+ height: 10
+ }
+ Rectangle {
+ objectName: "three"
+ color: "red"
+ width: 40
+ height: 20
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/data/vertical.qml b/tests/auto/declarative/layouts/data/vertical.qml
new file mode 100644
index 0000000..856c180
--- /dev/null
+++ b/tests/auto/declarative/layouts/data/vertical.qml
@@ -0,0 +1,26 @@
+import Qt 4.6
+
+Item {
+ width: 640
+ height: 480
+ Column {
+ Rectangle {
+ objectName: "one"
+ color: "red"
+ width: 50
+ height: 50
+ }
+ Rectangle {
+ objectName: "two"
+ color: "red"
+ width: 20
+ height: 10
+ }
+ Rectangle {
+ objectName: "three"
+ color: "red"
+ width: 40
+ height: 20
+ }
+ }
+}
diff --git a/tests/auto/declarative/layouts/layouts.pro b/tests/auto/declarative/layouts/layouts.pro
new file mode 100644
index 0000000..f7e7622
--- /dev/null
+++ b/tests/auto/declarative/layouts/layouts.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_layouts.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/layouts/tst_layouts.cpp b/tests/auto/declarative/layouts/tst_layouts.cpp
new file mode 100644
index 0000000..3416b2e
--- /dev/null
+++ b/tests/auto/declarative/layouts/tst_layouts.cpp
@@ -0,0 +1,200 @@
+#include <QtTest/QtTest>
+#include <qlistmodelinterface.h>
+#include <qfxview.h>
+#include <qfxrect.h>
+#include <qmlexpression.h>
+
+class tst_QFxLayouts : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QFxLayouts();
+
+private slots:
+ void test_horizontal();
+ void test_horizontal_spacing();
+ void test_vertical();
+ void test_vertical_spacing();
+ void test_grid();
+ void test_grid_spacing();
+
+private:
+ QFxView *createView(const QString &filename);
+};
+
+tst_QFxLayouts::tst_QFxLayouts()
+{
+}
+
+void tst_QFxLayouts::test_horizontal()
+{
+ QFxView *canvas = createView(SRCDIR "/data/horizontal.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("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_QFxLayouts::test_horizontal_spacing()
+{
+ QFxView *canvas = createView(SRCDIR "/data/horizontal-spacing.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("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_QFxLayouts::test_vertical()
+{
+ QFxView *canvas = createView(SRCDIR "/data/vertical.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("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_QFxLayouts::test_vertical_spacing()
+{
+ QFxView *canvas = createView(SRCDIR "/data/vertical-spacing.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("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_QFxLayouts::test_grid()
+{
+ QFxView *canvas = createView("data/grid.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
+ QVERIFY(three != 0);
+ QFxRect *four = canvas->root()->findChild<QFxRect*>("four");
+ QVERIFY(four != 0);
+ QFxRect *five = canvas->root()->findChild<QFxRect*>("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_QFxLayouts::test_grid_spacing()
+{
+ QFxView *canvas = createView("data/grid-spacing.qml");
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxRect *one = canvas->root()->findChild<QFxRect*>("one");
+ QVERIFY(one != 0);
+ QFxRect *two = canvas->root()->findChild<QFxRect*>("two");
+ QVERIFY(two != 0);
+ QFxRect *three = canvas->root()->findChild<QFxRect*>("three");
+ QVERIFY(three != 0);
+ QFxRect *four = canvas->root()->findChild<QFxRect*>("four");
+ QVERIFY(four != 0);
+ QFxRect *five = canvas->root()->findChild<QFxRect*>("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);
+}
+
+QFxView *tst_QFxLayouts::createView(const QString &filename)
+{
+ QFxView *canvas = new QFxView(0);
+
+ QFile file(filename);
+ file.open(QFile::ReadOnly);
+ QString xml = file.readAll();
+ canvas->setQml(xml, filename);
+
+ return canvas;
+}
+
+
+QTEST_MAIN(tst_QFxLayouts)
+
+#include "tst_layouts.moc"
diff --git a/tests/auto/declarative/listview/data/listview.qml b/tests/auto/declarative/listview/data/listview.qml
new file mode 100644
index 0000000..1a241eb
--- /dev/null
+++ b/tests/auto/declarative/listview/data/listview.qml
@@ -0,0 +1,45 @@
+import Qt 4.6
+
+Rectangle {
+ width: 240
+ height: 320
+ color: "#ffffff"
+ resources: [
+ Component {
+ id: Delegate
+ Item {
+ 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
+ }
+ }
+ }
+ ]
+ ListView {
+ id: list
+ objectName: "list"
+ width: 240
+ height: 320
+ model: testModel
+ delegate: Delegate
+ }
+}
diff --git a/tests/auto/declarative/listview/listview.pro b/tests/auto/declarative/listview/listview.pro
new file mode 100644
index 0000000..bf68268
--- /dev/null
+++ b/tests/auto/declarative/listview/listview.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_listview.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/listview/tst_listview.cpp b/tests/auto/declarative/listview/tst_listview.cpp
new file mode 100644
index 0000000..ebc3053
--- /dev/null
+++ b/tests/auto/declarative/listview/tst_listview.cpp
@@ -0,0 +1,488 @@
+#include <QtTest/QtTest>
+#include <qlistmodelinterface.h>
+#include <qfxview.h>
+#include <qfxlistview.h>
+#include <qfxtext.h>
+#include <qmlcontext.h>
+#include <qmlexpression.h>
+
+class tst_QFxListView : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QFxListView();
+
+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();
+
+private:
+ template <class T> void items();
+ template <class T> void changed();
+ template <class T> void inserted();
+ template <class T> void removed();
+ QFxView *createView(const QString &filename);
+ template<typename T>
+ T *findItem(QFxItem *parent, const QString &id, int index=0);
+};
+
+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 "";
+ }
+ }
+
+ 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 modifyItem(int index, const QString &name, const QString &number) {
+ list[index] = QPair<QString,QString>(name, number);
+ emit itemsChanged(index, 1, roles());
+ }
+
+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 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_QFxListView::tst_QFxListView()
+{
+}
+
+template <class T>
+void tst_QFxListView::items()
+{
+ QFxView *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);
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxFlickable *listview = findItem<QFxFlickable>(canvas->root(), "list");
+ QVERIFY(listview != 0);
+
+ QFxItem *viewport = listview->viewport();
+ QVERIFY(viewport != 0);
+
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
+
+ for (int i = 0; i < model.count(); ++i) {
+ QFxText *name = findItem<QFxText>(viewport, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ QFxText *number = findItem<QFxText>(viewport, "textNumber", i);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(i));
+ }
+
+ delete canvas;
+}
+
+template <class T>
+void tst_QFxListView::changed()
+{
+ QFxView *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);
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxFlickable *listview = findItem<QFxFlickable>(canvas->root(), "list");
+ QVERIFY(listview != 0);
+
+ QFxItem *viewport = listview->viewport();
+ QVERIFY(viewport != 0);
+
+ model.modifyItem(1, "Will", "9876");
+ QFxText *name = findItem<QFxText>(viewport, "textName", 1);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(1));
+ QFxText *number = findItem<QFxText>(viewport, "textNumber", 1);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(1));
+
+ delete canvas;
+}
+
+template <class T>
+void tst_QFxListView::inserted()
+{
+ QFxView *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);
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxListView *listview = findItem<QFxListView>(canvas->root(), "list");
+ QVERIFY(listview != 0);
+
+ QFxItem *viewport = listview->viewport();
+ QVERIFY(viewport != 0);
+
+ model.insertItem(1, "Will", "9876");
+
+ // let transitions settle.
+ QTest::qWait(1000);
+
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
+
+ QFxText *name = findItem<QFxText>(viewport, "textName", 1);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(1));
+ QFxText *number = findItem<QFxText>(viewport, "textNumber", 1);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(1));
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count(); ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ QVERIFY(item->y() == i*20);
+ }
+
+ model.insertItem(0, "Foo", "1111"); // zero index, and current item
+
+ // let transitions settle.
+ QTest::qWait(1000);
+
+ QCOMPARE(viewport->childItems().count(), model.count()); // assumes all are visible
+
+ name = findItem<QFxText>(viewport, "textName", 0);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(0));
+ number = findItem<QFxText>(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) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ QVERIFY(item->y() == i*20);
+ }
+
+ delete canvas;
+}
+
+template <class T>
+void tst_QFxListView::removed()
+{
+ QFxView *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);
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxListView *listview = findItem<QFxListView>(canvas->root(), "list");
+ QVERIFY(listview != 0);
+
+ QFxItem *viewport = listview->viewport();
+ QVERIFY(viewport != 0);
+
+ model.removeItem(1);
+
+ // let transitions settle.
+ QTest::qWait(1000);
+
+ QFxText *name = findItem<QFxText>(viewport, "textName", 1);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(1));
+ QFxText *number = findItem<QFxText>(viewport, "textNumber", 1);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(1));
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ 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(1000);
+
+ name = findItem<QFxText>(viewport, "textName", 0);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(0));
+ number = findItem<QFxText>(viewport, "textNumber", 0);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(0));
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ QCOMPARE(item->y(),i*20.0 + 20.0);
+ }
+
+ // Remove items not visible
+ model.removeItem(18);
+ // let transitions settle.
+ QTest::qWait(1000);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ 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(1000);
+
+ // Confirm items positioned correctly
+ for (int i = 2; i < 18; ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ QCOMPARE(item->y(),40+i*20.0);
+ }
+
+ listview->setViewportY(40); // That's the top now
+ // let transitions settle.
+ QTest::qWait(1000);
+
+ // Confirm items positioned correctly
+ for (int i = 0; i < model.count() && i < viewport->childItems().count(); ++i) {
+ QFxItem *item = findItem<QFxItem>(viewport, "wrapper", i);
+ QCOMPARE(item->y(),40+i*20.0);
+ }
+
+ delete canvas;
+}
+
+void tst_QFxListView::qListModelInterface_items()
+{
+ items<TestModel>();
+}
+
+void tst_QFxListView::qAbstractItemModel_items()
+{
+ items<TestModel2>();
+}
+
+void tst_QFxListView::qListModelInterface_changed()
+{
+ changed<TestModel>();
+}
+
+void tst_QFxListView::qAbstractItemModel_changed()
+{
+ changed<TestModel2>();
+}
+
+void tst_QFxListView::qListModelInterface_inserted()
+{
+ inserted<TestModel>();
+}
+
+void tst_QFxListView::qAbstractItemModel_inserted()
+{
+ inserted<TestModel2>();
+}
+
+void tst_QFxListView::qListModelInterface_removed()
+{
+ removed<TestModel>();
+}
+
+void tst_QFxListView::qAbstractItemModel_removed()
+{
+ removed<TestModel2>();
+}
+
+QFxView *tst_QFxListView::createView(const QString &filename)
+{
+ QFxView *canvas = new QFxView(0);
+ canvas->setFixedSize(240,320);
+
+ QFile file(filename);
+ file.open(QFile::ReadOnly);
+ QString qml = file.readAll();
+ canvas->setQml(qml, filename);
+
+ return canvas;
+}
+
+/*
+ Find an item with the specified id. If index is supplied then the
+ item must also evaluate the {index} expression equal to index
+*/
+template<typename T>
+T *tst_QFxListView::findItem(QFxItem *parent, const QString &objectName, int index)
+{
+ const QMetaObject &mo = T::staticMetaObject;
+ //qDebug() << parent->QGraphicsObject::children().count() << "children";
+ for (int i = 0; i < parent->QGraphicsObject::children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->QGraphicsObject::children().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;
+}
+
+QTEST_MAIN(tst_QFxListView)
+
+#include "tst_listview.moc"
diff --git a/tests/auto/declarative/numberformatter/numberformatter.pro b/tests/auto/declarative/numberformatter/numberformatter.pro
new file mode 100644
index 0000000..ba391ed
--- /dev/null
+++ b/tests/auto/declarative/numberformatter/numberformatter.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_numberformatter.cpp
diff --git a/tests/auto/declarative/numberformatter/tst_numberformatter.cpp b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
new file mode 100644
index 0000000..78ec347
--- /dev/null
+++ b/tests/auto/declarative/numberformatter/tst_numberformatter.cpp
@@ -0,0 +1,224 @@
+#include <qtest.h>
+#include <QDebug>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qnumberformat.h>
+#include <QtDeclarative/qmlnumberformatter.h>
+
+class tst_numberformat : public QObject
+{
+ Q_OBJECT
+public:
+ tst_numberformat();
+
+ void init() {}
+ void initTestCase() {}
+
+ void cleanup() {}
+ void cleanupTestCase() {}
+
+private slots:
+ void number_data();
+ void number();
+
+ void text_data();
+ void text();
+
+private:
+ QStringList strings;
+ QList<float> numbers;
+ QStringList formats;
+ QStringList texts;
+};
+
+tst_numberformat::tst_numberformat()
+{
+ strings << "100.0"
+ << "12345"
+ << "1234567"
+ << "0.123"
+ << "0.9999"
+ << "0.989"
+ << "1"
+ << "1.0"
+ << "1.01";
+
+ numbers << 100
+ << 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_numberformat::number_data()
+{
+ QTest::addColumn<QString>("string");
+ QTest::addColumn<float>("number");
+
+ for (int i = 0; i < strings.size(); i++)
+ QTest::newRow(QString::number(i).toAscii()) << strings.at(i) << numbers.at(i);
+}
+
+void tst_numberformat::number()
+{
+ // ### tests the conversion from string to float
+ QFETCH(QString, string);
+ QFETCH(float, number);
+
+ QString componentStr = QString("import Qt 4.6\nNumberFormatter { number: \"") + string + QString("\" }");
+
+ QmlEngine engine;
+ QmlComponent formatterComponent(&engine, componentStr.toAscii(), QUrl("file://"));
+ if(formatterComponent.isError())
+ qDebug() << formatterComponent.errors();
+ QVERIFY(formatterComponent.isReady());
+ QmlNumberFormatter *formatter = qobject_cast<QmlNumberFormatter*>(formatterComponent.create());
+ QVERIFY(formatterComponent.isReady());
+ QVERIFY(formatter != 0);
+ QCOMPARE((float)formatter->number(), number);
+ //qDebug() << formatter->format() << formatter->text();
+ QVERIFY(formatter->format().isEmpty());
+ QVERIFY(formatter->text() == QString("%1").arg(number, -1, 'f', -1));
+}
+
+void tst_numberformat::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_numberformat::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, componentStr.toAscii(), QUrl("file://"));
+ 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);
+}
+
+QTEST_MAIN(tst_numberformat)
+
+#include "tst_numberformatter.moc"
diff --git a/tests/auto/declarative/pathview/data/pathview.qml b/tests/auto/declarative/pathview/data/pathview.qml
new file mode 100644
index 0000000..be5673c
--- /dev/null
+++ b/tests/auto/declarative/pathview/data/pathview.qml
@@ -0,0 +1,66 @@
+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: textName
+ objectName: "textName"
+ text: name
+ }
+ Text {
+ x: 40
+ id: textNumber
+ objectName: "textNumber"
+ text: number
+ }
+ }
+ }
+ ]
+ 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/pathview/pathview.pro b/tests/auto/declarative/pathview/pathview.pro
new file mode 100644
index 0000000..28bbe49
--- /dev/null
+++ b/tests/auto/declarative/pathview/pathview.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_pathview.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/pathview/tst_pathview.cpp b/tests/auto/declarative/pathview/tst_pathview.cpp
new file mode 100644
index 0000000..2933323
--- /dev/null
+++ b/tests/auto/declarative/pathview/tst_pathview.cpp
@@ -0,0 +1,261 @@
+#include <QtTest/QtTest>
+#include <qlistmodelinterface.h>
+#include <qfxview.h>
+#include <qfxpathview.h>
+#include <qfxtext.h>
+#include <qfxrect.h>
+#include <qmlcontext.h>
+#include <qmlexpression.h>
+
+class tst_QFxPathView : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QFxPathView();
+
+private slots:
+ void items();
+ void pathMoved();
+ void limitedItems();
+
+private:
+ QFxView *createView(const QString &filename);
+ template<typename T>
+ T *findItem(QFxItem *parent, const QString &id, int index=0);
+};
+
+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 "";
+ }
+ }
+
+ 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 modifyItem(int index, const QString &name, const QString &number) {
+ list[index] = QPair<QString,QString>(name, number);
+ emit itemsChanged(index, 1, roles());
+ }
+
+private:
+ QList<QPair<QString,QString> > list;
+};
+
+tst_QFxPathView::tst_QFxPathView()
+{
+}
+
+void tst_QFxPathView::items()
+{
+ QFxView *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();
+
+ QFxPathView *pathview = findItem<QFxPathView>(canvas->root(), "view");
+ QVERIFY(pathview != 0);
+
+ QCOMPARE(pathview->childItems().count(), model.count()); // assumes all are visible
+
+ for (int i = 0; i < model.count(); ++i) {
+ QFxText *name = findItem<QFxText>(pathview, "textName", i);
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), model.name(i));
+ QFxText *number = findItem<QFxText>(pathview, "textNumber", i);
+ QVERIFY(number != 0);
+ QCOMPARE(number->text(), model.number(i));
+ }
+
+ delete canvas;
+}
+
+void tst_QFxPathView::pathMoved()
+{
+ QFxView *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();
+
+ QFxPathView *pathview = findItem<QFxPathView>(canvas->root(), "view");
+ QVERIFY(pathview != 0);
+
+ QFxRect *firstItem = findItem<QFxRect>(pathview, "wrapper", 0);
+ QVERIFY(firstItem);
+ QFxPath *path = qobject_cast<QFxPath*>(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++){
+ QFxRect *curItem = findItem<QFxRect>(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_QFxPathView::limitedItems()
+{
+ QFxView *canvas = createView(SRCDIR "/data/pathview.qml");
+
+ TestModel model;
+ for(int i=0; i<100; i++)
+ model.addItem("Bob", QString::number(i));
+
+ QmlContext *ctxt = canvas->rootContext();
+ ctxt->setContextProperty("testModel", &model);
+
+ canvas->execute();
+ qApp->processEvents();
+
+ QFxPathView *pathview = findItem<QFxPathView>(canvas->root(), "view");
+ QVERIFY(pathview != 0);
+
+ pathview->setPathItemCount(10);
+ QCOMPARE(pathview->pathItemCount(), 10);
+
+ QFxRect *testItem = findItem<QFxRect>(pathview, "wrapper", 0);
+ QVERIFY(testItem != 0);
+ testItem = findItem<QFxRect>(pathview, "wrapper", 9);
+ QVERIFY(testItem != 0);
+ testItem = findItem<QFxRect>(pathview, "wrapper", 10);
+ QVERIFY(testItem == 0);
+
+ pathview->setCurrentIndex(50);
+ QTest::qWait(5100);//Moving is animated and it's travelling far - should be reconsidered.
+ testItem = findItem<QFxRect>(pathview, "wrapper", 0);
+ QVERIFY(testItem == 0);
+ testItem = findItem<QFxRect>(pathview, "wrapper", 1);
+ QVERIFY(testItem == 0);
+ testItem = findItem<QFxRect>(pathview, "wrapper", 9);
+ QVERIFY(testItem == 0);
+ testItem = findItem<QFxRect>(pathview, "wrapper", 50);
+ QVERIFY(testItem != 0);
+}
+
+QFxView *tst_QFxPathView::createView(const QString &filename)
+{
+ QFxView *canvas = new QFxView(0);
+ canvas->setFixedSize(240,320);
+
+ QFile file(filename);
+ file.open(QFile::ReadOnly);
+ QString qml = file.readAll();
+ canvas->setQml(qml, 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_QFxPathView::findItem(QFxItem *parent, const QString &objectName, int index)
+{
+ const QMetaObject &mo = T::staticMetaObject;
+ for (int i = 0; i < parent->children().count(); ++i) {
+ QFxItem *item = qobject_cast<QFxItem*>(parent->children().at(i));
+ if(!item)
+ continue;
+ 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;
+}
+
+QTEST_MAIN(tst_QFxPathView)
+
+#include "tst_pathview.moc"
diff --git a/tests/auto/declarative/qbindablemap/qbindablemap.pro b/tests/auto/declarative/qbindablemap/qbindablemap.pro
new file mode 100644
index 0000000..b042405
--- /dev/null
+++ b/tests/auto/declarative/qbindablemap/qbindablemap.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qbindablemap.cpp
diff --git a/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
new file mode 100644
index 0000000..c9c37ab
--- /dev/null
+++ b/tests/auto/declarative/qbindablemap/tst_qbindablemap.cpp
@@ -0,0 +1,74 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcontext.h>
+#include <QtDeclarative/qbindablemap.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QSignalSpy>
+
+class tst_QBindableMap : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QBindableMap() {}
+
+private slots:
+ void insert();
+ void clear();
+ void changed();
+};
+
+void tst_QBindableMap::insert()
+{
+ QBindableMap map;
+ map.setValue(QLatin1String("key1"),100);
+ map.setValue(QLatin1String("key2"),200);
+ QVERIFY(map.keys().count() == 2);
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant(100));
+ QCOMPARE(map.value(QLatin1String("key2")), QVariant(200));
+
+ map.setValue(QLatin1String("key1"),"Hello World");
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+}
+
+void tst_QBindableMap::clear()
+{
+ QBindableMap map;
+ map.setValue(QLatin1String("key1"),100);
+ QVERIFY(map.keys().count() == 1);
+
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant(100));
+
+ map.clearValue(QLatin1String("key1"));
+ QVERIFY(map.keys().count() == 1);
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant());
+}
+
+void tst_QBindableMap::changed()
+{
+ QBindableMap map;
+ QSignalSpy spy(&map, SIGNAL(changed(const QString&)));
+ map.setValue(QLatin1String("key1"),100);
+ map.setValue(QLatin1String("key2"),200);
+ QCOMPARE(spy.count(), 0);
+
+ map.clearValue(QLatin1String("key1"));
+ QCOMPARE(spy.count(), 0);
+
+ //make changes in QML
+ QmlEngine engine;
+ QmlContext *ctxt = engine.rootContext();
+ ctxt->setContextProperty(QLatin1String("data"), &map);
+ QmlComponent component(&engine, "import Qt 4.6\nScript { script: \"data.key1 = 'Hello World';\" }",
+ QUrl("file://"));
+ QVERIFY(component.isReady());
+ component.create();
+ QCOMPARE(spy.count(), 1);
+ QList<QVariant> arguments = spy.takeFirst();
+ QCOMPARE(arguments.at(0).toString(),QLatin1String("key1"));
+ QCOMPARE(map.value(QLatin1String("key1")), QVariant("Hello World"));
+}
+
+QTEST_MAIN(tst_QBindableMap)
+
+#include "tst_qbindablemap.moc"
diff --git a/tests/auto/declarative/qfxloader/NoResize.qml b/tests/auto/declarative/qfxloader/NoResize.qml
new file mode 100644
index 0000000..cfbb55a
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/NoResize.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+Loader {
+ resizeMode: "NoResize"
+ width: 200; height: 80
+ source: "Rect120x60.qml"
+}
diff --git a/tests/auto/declarative/qfxloader/Rect120x60.qml b/tests/auto/declarative/qfxloader/Rect120x60.qml
new file mode 100644
index 0000000..aa4b0c2
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/Rect120x60.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+Rectangle {
+ width: 120
+ height:60
+}
diff --git a/tests/auto/declarative/qfxloader/SetSourceComponent.qml b/tests/auto/declarative/qfxloader/SetSourceComponent.qml
new file mode 100644
index 0000000..c5dd7ff
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/SetSourceComponent.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+Item {
+ Component { id: Comp; Rectangle { width: 120; height: 60 } }
+ Loader { sourceComponent: Comp }
+}
diff --git a/tests/auto/declarative/qfxloader/SizeToItem.qml b/tests/auto/declarative/qfxloader/SizeToItem.qml
new file mode 100644
index 0000000..b52fa03
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/SizeToItem.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+Loader {
+ resizeMode: "SizeLoaderToItem"
+ source: "Rect120x60.qml"
+}
diff --git a/tests/auto/declarative/qfxloader/SizeToLoader.qml b/tests/auto/declarative/qfxloader/SizeToLoader.qml
new file mode 100644
index 0000000..1a107e1
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/SizeToLoader.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+
+Loader {
+ resizeMode: "SizeItemToLoader"
+ width: 200; height: 80
+ source: "Rect120x60.qml"
+}
diff --git a/tests/auto/declarative/qfxloader/qfxloader.pro b/tests/auto/declarative/qfxloader/qfxloader.pro
new file mode 100644
index 0000000..643c18c
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/qfxloader.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+SOURCES += tst_qfxloader.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qfxloader/tst_qfxloader.cpp b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp
new file mode 100644
index 0000000..2109898
--- /dev/null
+++ b/tests/auto/declarative/qfxloader/tst_qfxloader.cpp
@@ -0,0 +1,103 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxloader.h>
+
+class tst_qfxloader : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qfxloader();
+
+private slots:
+ void url();
+ void component();
+ void sizeLoaderToItem();
+ void sizeItemToLoader();
+ void noResize();
+
+private:
+ QmlEngine engine;
+};
+
+/*
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
+*/
+
+tst_qfxloader::tst_qfxloader()
+{
+}
+
+void tst_qfxloader::url()
+{
+ QmlComponent component(&engine, QByteArray("import Qt 4.6\nLoader { source: \"Rect120x60.qml\" }"), QUrl("file://" SRCDIR "/"));
+ QFxLoader *loader = qobject_cast<QFxLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1);
+}
+
+void tst_qfxloader::component()
+{
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/SetSourceComponent.qml"));
+ QFxItem *item = qobject_cast<QFxItem*>(component.create());
+ QVERIFY(item);
+
+ QFxLoader *loader = qobject_cast<QFxLoader*>(item->QGraphicsObject::children().at(1));
+ QVERIFY(loader);
+ QVERIFY(loader->item());
+ QCOMPARE(loader->progress(), 1.0);
+ QCOMPARE(static_cast<QGraphicsItem*>(loader)->children().count(), 1);
+}
+
+void tst_qfxloader::sizeLoaderToItem()
+{
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/SizeToItem.qml"));
+ QFxLoader *loader = qobject_cast<QFxLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 120.0);
+ QCOMPARE(loader->height(), 60.0);
+}
+
+void tst_qfxloader::sizeItemToLoader()
+{
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/SizeToLoader.qml"));
+ QFxLoader *loader = qobject_cast<QFxLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 200.0);
+ QCOMPARE(loader->height(), 80.0);
+
+ QFxItem *rect = loader->item();
+ QVERIFY(rect);
+ QCOMPARE(rect->width(), 200.0);
+ QCOMPARE(rect->height(), 80.0);
+}
+
+void tst_qfxloader::noResize()
+{
+ QmlComponent component(&engine, QUrl("file://" SRCDIR "/NoResize.qml"));
+ QFxLoader *loader = qobject_cast<QFxLoader*>(component.create());
+ QVERIFY(loader != 0);
+ QCOMPARE(loader->width(), 200.0);
+ QCOMPARE(loader->height(), 80.0);
+
+ QFxItem *rect = loader->item();
+ QVERIFY(rect);
+ QCOMPARE(rect->width(), 120.0);
+ QCOMPARE(rect->height(), 60.0);
+}
+
+QTEST_MAIN(tst_qfxloader)
+
+#include "tst_qfxloader.moc"
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists.png b/tests/auto/declarative/qfxpixmapcache/data/exists.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qfxpixmapcache/data/exists.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists1.png b/tests/auto/declarative/qfxpixmapcache/data/exists1.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qfxpixmapcache/data/exists1.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/data/exists2.png b/tests/auto/declarative/qfxpixmapcache/data/exists2.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/qfxpixmapcache/data/exists2.png
Binary files differ
diff --git a/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
new file mode 100644
index 0000000..e9b0417
--- /dev/null
+++ b/tests/auto/declarative/qfxpixmapcache/qfxpixmapcache.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+QT += network
+SOURCES += tst_qfxpixmapcache.cpp
+HEADERS =
+macx:CONFIG -= app_bundle
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp
new file mode 100644
index 0000000..4d3ad55
--- /dev/null
+++ b/tests/auto/declarative/qfxpixmapcache/tst_qfxpixmapcache.cpp
@@ -0,0 +1,226 @@
+#include <qtest.h>
+#include <QtTest/QtTest>
+#include <QtDeclarative/qfxpixmapcache.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QNetworkReply>
+
+// These don't let normal people run tests!
+//#include "../network-settings.h"
+
+class tst_qfxpixmapcache : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qfxpixmapcache() :
+ thisfile("file://" __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_qfxpixmapcache::single_data()
+{
+ // Note, since QFxPixmapCache 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");
+
+ // File URLs are optimized
+ QTest::newRow("local") << thisfile.resolved(QUrl("data/exists.png")) << localfile_optimized << true;
+ QTest::newRow("local") << thisfile.resolved(QUrl("data/notexists.png")) << localfile_optimized << false;
+ QTest::newRow("remote") << QUrl("http://qt.nokia.com/logo.png") << false << true;
+ QTest::newRow("remote") << QUrl("http://qt.nokia.com/thereisnologo.png") << false << false;
+}
+
+void tst_qfxpixmapcache::single()
+{
+ QFETCH(QUrl, target);
+ QFETCH(bool, incache);
+ QFETCH(bool, exists);
+
+ QPixmap pixmap;
+ QVERIFY(pixmap.width() <= 0); // Check Qt assumption
+ QNetworkReply *reply= QFxPixmapCache::get(&engine, target, &pixmap);
+
+ if (incache) {
+ QVERIFY(!reply);
+ if (exists)
+ QVERIFY(pixmap.width() > 0);
+ else
+ QVERIFY(pixmap.width() <= 0);
+ } else {
+ 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(QFxPixmapCache::find(target, &pixmap));
+ QVERIFY(pixmap.width() > 0);
+ } else {
+ QVERIFY(!QFxPixmapCache::find(target, &pixmap));
+ QVERIFY(pixmap.width() <= 0);
+ }
+ }
+
+ QCOMPARE(QFxPixmapCache::pendingRequests(), 0);
+}
+
+void tst_qfxpixmapcache::parallel_data()
+{
+ // Note, since QFxPixmapCache 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_qfxpixmapcache::parallel()
+{
+ QFETCH(QUrl, target1);
+ QFETCH(QUrl, target2);
+ QFETCH(int, incache);
+ QFETCH(int, cancel);
+ QFETCH(int, requests);
+
+ QList<QUrl> targets;
+ targets << target1 << target2;
+
+ QList<QNetworkReply*> replies;
+ QList<Slotter*> getters;
+ for (int i=0; i<targets.count(); ++i) {
+ QUrl target = targets.at(i);
+ QPixmap pixmap;
+ QNetworkReply *reply = QFxPixmapCache::get(&engine, target, &pixmap);
+ 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(QFxPixmapCache::pendingRequests(), requests);
+
+ if (cancel >= 0) {
+ QFxPixmapCache::cancelGet(targets.at(cancel), getters[cancel]);
+ slotters--;
+ }
+
+ if (slotters) {
+ QTestEventLoop::instance().enterLoop(10);
+ QVERIFY(!QTestEventLoop::instance().timeout());
+ }
+
+ for (int i=0; i<targets.count(); ++i) {
+ QNetworkReply *reply = replies[i];
+ if (reply) {
+ if (i == cancel) {
+ QVERIFY(!getters[i]->gotslot);
+ } else {
+ QVERIFY(getters[i]->gotslot);
+ QPixmap pixmap;
+ QVERIFY(QFxPixmapCache::find(targets[i], &pixmap));
+ QVERIFY(pixmap.width() > 0);
+ }
+ delete getters[i];
+ }
+ }
+
+ QCOMPARE(QFxPixmapCache::pendingRequests(), 0);
+}
+
+QTEST_MAIN(tst_qfxpixmapcache)
+
+#include "tst_qfxpixmapcache.moc"
diff --git a/tests/auto/declarative/qfxtext/qfxtext.pro b/tests/auto/declarative/qfxtext/qfxtext.pro
new file mode 100644
index 0000000..f705334
--- /dev/null
+++ b/tests/auto/declarative/qfxtext/qfxtext.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+SOURCES += tst_qfxtext.cpp
diff --git a/tests/auto/declarative/qfxtext/tst_qfxtext.cpp b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
new file mode 100644
index 0000000..cae85a4
--- /dev/null
+++ b/tests/auto/declarative/qfxtext/tst_qfxtext.cpp
@@ -0,0 +1,413 @@
+#include <qtest.h>
+#include <QTextDocument>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxtext.h>
+#include <QFontMetrics>
+
+class tst_qfxtext : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qfxtext();
+
+private slots:
+ void text();
+ void width();
+ void wrap();
+ void elide();
+
+ // ### these tests may be trivial
+ void horizontalAlignment();
+ void verticalAlignment();
+ void font();
+ void style();
+ void color();
+
+private:
+ QStringList standard;
+ QStringList richText;
+
+ QStringList horizontalAlignmentmentStrings;
+ QStringList verticalAlignmentmentStrings;
+
+ QList<Qt::Alignment> verticalAlignmentments;
+ QList<Qt::Alignment> horizontalAlignmentments;
+
+ QStringList styleStrings;
+ QList<QFxText::TextStyle> styles;
+
+ QStringList colorStrings;
+
+ QmlEngine engine;
+};
+
+tst_qfxtext::tst_qfxtext()
+{
+ 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 << QFxText::Normal
+ << QFxText::Outline
+ << QFxText::Raised
+ << QFxText::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_qfxtext::text()
+{
+ {
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->text(), QString(""));
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QCOMPARE(textObject->text(), standard.at(i));
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QVERIFY(textObject != 0);
+ QString expected = richText.at(i);
+ QCOMPARE(textObject->text(), expected.replace("\\\"", "\""));
+ }
+}
+
+void tst_qfxtext::width()
+{
+ // uses Font metrics to find the width for standard and document to find the width for rich
+ {
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\" }", QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 0.);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QFont f;
+ QFontMetrics fm(f);
+ int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
+
+ QString componentStr = "import Qt 4.6\nText { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), qreal(metricWidth));
+ }
+
+ 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\nText { text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), qreal(documentWidth));
+ }
+}
+
+void tst_qfxtext::wrap()
+{
+ // XXX Poor coverage - should at least be testing an expected height.
+
+ // for specified width and wrap set true
+ {
+ QmlComponent textComponent(&engine, "import Qt 4.6\nText { text: \"\"; wrap: true; width: 300 }", QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { wrap: true; width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+
+}
+
+void tst_qfxtext::elide()
+{
+ for (Qt::TextElideMode m = Qt::ElideLeft; m<=Qt::ElideNone; m=Qt::TextElideMode(int(m)+1)) {
+ const char* elidename[]={"ElideLeft", "ElideRight", "ElideMiddle", "ElideNone"};
+ QString elide = "elide: \""+QString(elidename[int(m)])+"\";";
+
+ // XXX Poor coverage.
+
+ {
+ QmlComponent textComponent(&engine, ("import Qt 4.6\nText { text: \"\"; "+elide+" width: 300 }").toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + standard.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+
+ // richtext - does nothing
+ for (int i = 0; i < richText.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { "+elide+" width: 300; text: \"" + richText.at(i) + "\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->width(), 300.);
+ }
+ }
+}
+
+//the alignment tests may be trivial o.oa
+void tst_qfxtext::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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->hAlign(), (int)horizontalAlignmentments.at(j));
+ }
+ }
+
+}
+
+void tst_qfxtext::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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ 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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->vAlign(), (int)verticalAlignmentments.at(j));
+ }
+ }
+
+}
+
+void tst_qfxtext::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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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.bold: true; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->font().family(), QString(""));
+ }
+}
+
+void tst_qfxtext::style()
+{
+ //test style
+ for (int i = 0; i < styles.size(); i++)
+ {
+ QString componentStr = "import Qt 4.6\nText { style: \"" + styleStrings.at(i) + "\"; text: \"Hello World\" }";
+ QmlComponent textComponent(&engine, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE((int)textObject->style(), (int)styles.at(i));
+ QCOMPARE(textObject->styleColor(), QColor());
+ }
+}
+
+void tst_qfxtext::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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(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, componentStr.toLatin1(), QUrl("file://"));
+ QFxText *textObject = qobject_cast<QFxText*>(textComponent.create());
+
+ QCOMPARE(textObject->color(), testColor);
+ }
+}
+QTEST_MAIN(tst_qfxtext)
+
+#include "tst_qfxtext.moc"
diff --git a/tests/auto/declarative/qfxtextedit/data/cursorTest.qml b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
new file mode 100644
index 0000000..e5df8f1
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/data/cursorTest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Rectangle { width: 300; height: 300; color: "white"
+ TextEdit { text: "Hello world!"; id: textEditObject; objectName: "textEditObject"
+ resources: [ Component { id:cursor; Item { id:cursorInstance; objectName: "cursorInstance" } } ]
+ cursorDelegate: cursor
+ }
+}
diff --git a/tests/auto/declarative/qfxtextedit/qfxtextedit.pro b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro
new file mode 100644
index 0000000..59ab6e5
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/qfxtextedit.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+SOURCES += tst_qfxtextedit.cpp
diff --git a/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
new file mode 100644
index 0000000..c4fc506
--- /dev/null
+++ b/tests/auto/declarative/qfxtextedit/tst_qfxtextedit.cpp
@@ -0,0 +1,457 @@
+#include <qtest.h>
+#include <QTextDocument>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcontext.h>
+#include <QtDeclarative/qmlexpression.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxtextedit.h>
+#include <QFontMetrics>
+
+class tst_qfxtextedit : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qfxtextedit();
+
+private slots:
+ void text();
+ void width();
+ void wrap();
+
+ // ### these tests may be trivial
+ void hAlign();
+ void vAlign();
+ void font();
+ void color();
+ void selection();
+
+ void cursorDelegate();
+
+private:
+ QStringList standard;
+ QStringList richText;
+
+ QStringList hAlignmentStrings;
+ QStringList vAlignmentStrings;
+
+ QList<Qt::Alignment> vAlignments;
+ QList<Qt::Alignment> hAlignments;
+
+ QStringList colorStrings;
+
+ QmlEngine engine;
+};
+
+tst_qfxtextedit::tst_qfxtextedit()
+{
+ 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_qfxtextedit::text()
+{
+ {
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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_qfxtextedit::width()
+{
+ // uses Font metrics to find the width for standard and document to find the width for rich
+ {
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\" }", QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 0.);
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QFont f;
+ QFontMetrics fm(f);
+ int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
+
+ QString componentStr = "import Qt 4.6\nTextEdit { text: \"" + standard.at(i) + "\" }";
+ QmlComponent texteditComponent(&engine, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), qreal(metricWidth));
+ }
+
+ 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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), qreal(documentWidth));
+ }
+}
+
+void tst_qfxtextedit::wrap()
+{
+ // for specified width and wrap set true
+ {
+ QmlComponent texteditComponent(&engine, "import Qt 4.6\nTextEdit { text: \"\"; wrap: true; width: 300 }", QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->width(), 300.);
+ }
+
+}
+
+//the alignment tests may be trivial o.oa
+void tst_qfxtextedit::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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE((int)textEditObject->hAlign(), (int)hAlignments.at(j));
+ }
+ }
+
+}
+
+void tst_qfxtextedit::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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE((int)textEditObject->vAlign(), (int)vAlignments.at(j));
+ }
+ }
+
+}
+
+void tst_qfxtextedit::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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->font().family(), QString(""));
+ }
+}
+
+void tst_qfxtextedit::color()
+{
+ //test style
+ 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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+ //qDebug() << "textEditObject: " << textEditObject->color() << "vs. " << QColor(colorStrings.at(i));
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->color(), 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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(texteditComponent.create());
+
+ QVERIFY(textEditObject != 0);
+ QCOMPARE(textEditObject->color(), testColor);
+ }
+}
+
+void tst_qfxtextedit::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, componentStr.toLatin1(), QUrl());
+ QFxTextEdit *textEditObject = qobject_cast<QFxTextEdit*>(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);
+}
+
+#include <QFxView>
+void tst_qfxtextedit::cursorDelegate()
+{
+ QFxView* view = new QFxView(0);
+ view->show();
+ view->setUrl(QUrl("data/cursorTest.qml"));
+ view->execute();
+ QFxTextEdit *textEditObject = view->root()->findChild<QFxTextEdit*>("textEditObject");
+ QVERIFY(textEditObject != 0);
+ QVERIFY(textEditObject->findChild<QFxItem*>("cursorInstance"));
+ //Test Delegate gets created
+ textEditObject->setFocus(true);
+ QFxItem* delegateObject = textEditObject->findChild<QFxItem*>("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<QFxItem*>("cursorInstance"));
+}
+
+QTEST_MAIN(tst_qfxtextedit)
+
+#include "tst_qfxtextedit.moc"
diff --git a/tests/auto/declarative/qfxtextinput/data/navigation.qml b/tests/auto/declarative/qfxtextinput/data/navigation.qml
new file mode 100644
index 0000000..282c52c
--- /dev/null
+++ b/tests/auto/declarative/qfxtextinput/data/navigation.qml
@@ -0,0 +1,23 @@
+import Qt 4.6
+
+Rectangle {
+ property var myInput: Input
+
+ width: 800; height: 600; color: "blue"
+
+ Item {
+ id: FirstItem;
+ KeyNavigation.right: Input
+ }
+
+ TextInput { id: Input; focus: true
+ KeyNavigation.left: FirstItem
+ KeyNavigation.right: LastItem
+ KeyNavigation.up: FirstItem
+ KeyNavigation.down: LastItem
+ }
+ Item {
+ id: LastItem
+ KeyNavigation.left: Input
+ }
+}
diff --git a/tests/auto/declarative/qfxtextinput/qfxtextinput.pro b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro
new file mode 100644
index 0000000..396e66d
--- /dev/null
+++ b/tests/auto/declarative/qfxtextinput/qfxtextinput.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative gui
+SOURCES += tst_qfxtextinput.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp
new file mode 100644
index 0000000..c883aa3
--- /dev/null
+++ b/tests/auto/declarative/qfxtextinput/tst_qfxtextinput.cpp
@@ -0,0 +1,365 @@
+#include <qtest.h>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qmlengine.h>
+#include <QFile>
+#include <QtDeclarative/qfxview.h>
+#include <QFxTextInput>
+#include <QDebug>
+
+class tst_qfxtextinput : public QObject
+
+{
+ Q_OBJECT
+public:
+ tst_qfxtextinput();
+
+private slots:
+ void text();
+ void width();
+ void font();
+ void color();
+ void selection();
+
+ void maxLength();
+ void masks();
+ void validators();
+
+ void cursorDelegate();
+ void navigation();
+
+private:
+ void simulateKey(QFxView *, int key);
+ QFxView *createView(const QString &filename);
+
+ QmlEngine engine;
+ QStringList standard;
+ QStringList colorStrings;
+};
+
+tst_qfxtextinput::tst_qfxtextinput()
+{
+ 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_qfxtextinput::text()
+{
+ {
+ QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->text(), standard.at(i));
+ }
+
+}
+
+void tst_qfxtextinput::width()
+{
+ // uses Font metrics to find the width for standard
+ {
+ QmlComponent textinputComponent(&engine, "import Qt 4.6\nTextInput { text: \"\" }", QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->width(), 1.);//1 for the cursor
+ }
+
+ for (int i = 0; i < standard.size(); i++)
+ {
+ QFont f;
+ QFontMetrics fm(f);
+ int metricWidth = fm.size(Qt::TextExpandTabs && Qt::TextShowMnemonic, standard.at(i)).width();
+
+ QString componentStr = "import Qt 4.6\nTextInput { text: \"" + standard.at(i) + "\" }";
+ QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->width(), qreal(metricWidth) + 1.);//1 for the cursor
+ }
+}
+
+void tst_qfxtextinput::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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->font().family(), QString(""));
+ }
+}
+
+void tst_qfxtextinput::color()
+{
+ //test style
+ 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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+ //qDebug() << "textinputObject: " << textinputObject->color() << "vs. " << QColor(colorStrings.at(i));
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->color(), 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, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(textinputComponent.create());
+
+ QVERIFY(textinputObject != 0);
+ QCOMPARE(textinputObject->color(), testColor);
+ }
+}
+
+void tst_qfxtextinput::selection()
+{
+ QString testStr = standard[0];
+ QString componentStr = "import Qt 4.6\nTextInput { text: \""+ testStr +"\"; }";
+ QmlComponent textinputComponent(&engine, componentStr.toLatin1(), QUrl());
+ QFxTextInput *textinputObject = qobject_cast<QFxTextInput*>(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_qfxtextinput::maxLength()
+{
+ QFxView *canvas = createView(SRCDIR "/data/navigation.qml");
+ canvas->execute();
+ canvas->show();
+
+ QVERIFY(canvas->root() != 0);
+
+ QFxItem *input = qobject_cast<QFxItem *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+
+ QVERIFY(input != 0);
+ //TODO: Me
+}
+
+void tst_qfxtextinput::masks()
+{
+ QFxView *canvas = createView(SRCDIR "/data/navigation.qml");
+ canvas->execute();
+ canvas->show();
+
+ QVERIFY(canvas->root() != 0);
+
+ QFxItem *input = qobject_cast<QFxItem *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+
+ QVERIFY(input != 0);
+ //TODO: Me
+}
+
+void tst_qfxtextinput::validators()
+{
+ QFxView *canvas = createView(SRCDIR "/data/navigation.qml");
+ canvas->execute();
+ canvas->show();
+
+ QVERIFY(canvas->root() != 0);
+
+ QFxItem *input = qobject_cast<QFxItem *>(qvariant_cast<QObject *>(canvas->root()->property("myInput")));
+
+ QVERIFY(input != 0);
+ //TODO: Me
+}
+
+/*
+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_qfxtextinput::navigation()
+{
+ QFxView *canvas = createView(SRCDIR "/data/navigation.qml");
+ canvas->execute();
+ canvas->show();
+
+ QVERIFY(canvas->root() != 0);
+
+ QFxItem *input = qobject_cast<QFxItem *>(qvariant_cast<QObject *>(canvas->root()->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_qfxtextinput::cursorDelegate()
+{
+ //TODO:Get the QFxTextInput test passing first
+}
+
+void tst_qfxtextinput::simulateKey(QFxView *view, int key)
+{
+ QKeyEvent press(QKeyEvent::KeyPress, key, 0);
+ QKeyEvent release(QKeyEvent::KeyRelease, key, 0);
+
+ QApplication::sendEvent(view, &press);
+ QApplication::sendEvent(view, &release);
+}
+
+QFxView *tst_qfxtextinput::createView(const QString &filename)
+{
+ QFxView *canvas = new QFxView(0);
+
+ QFile file(filename);
+ file.open(QFile::ReadOnly);
+ QString xml = file.readAll();
+ canvas->setQml(xml, filename);
+
+ return canvas;
+}
+
+QTEST_MAIN(tst_qfxtextinput)
+
+#include "tst_qfxtextinput.moc"
diff --git a/tests/auto/declarative/qmlbindengine/bindingLoop.txt b/tests/auto/declarative/qmlbindengine/bindingLoop.txt
new file mode 100644
index 0000000..8b22dd1
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/bindingLoop.txt
@@ -0,0 +1,14 @@
+import Qt.test 1.0
+
+MyQmlContainer {
+ children : [
+ MyQmlObject {
+ id: Object1
+ stringProperty: "hello" + Object2.stringProperty
+ },
+ MyQmlObject {
+ id: Object2
+ stringProperty: "hello" + Object1.stringProperty
+ }
+ ]
+}
diff --git a/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt
new file mode 100644
index 0000000..3147f63
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.1.txt
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: trueProperty?'pass':'fail'
+}
diff --git a/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt
new file mode 100644
index 0000000..c89bb49
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/boolPropertiesEvaluateAsBool.2.txt
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ stringProperty: falseProperty?'fail':'pass'
+}
diff --git a/tests/auto/declarative/qmlbindengine/deferredProperties.txt b/tests/auto/declarative/qmlbindengine/deferredProperties.txt
new file mode 100644
index 0000000..9dabafe
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/deferredProperties.txt
@@ -0,0 +1,7 @@
+import Qt.test 1.0
+
+MyDeferredObject {
+ value: 10
+ objectProperty: MyQmlObject {}
+ objectProperty2: MyQmlObject { id: blah }
+}
diff --git a/tests/auto/declarative/qmlbindengine/enums.1.qml b/tests/auto/declarative/qmlbindengine/enums.1.qml
new file mode 100644
index 0000000..6351823
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/enums.1.qml
@@ -0,0 +1,20 @@
+import Qt.test 1.0
+import Qt.test 1.0 as Namespace
+
+MyQmlObject {
+ // Enums from non-namespaced type
+ property int a: MyQmlObject.EnumValue1
+ property int b: MyQmlObject.EnumValue2
+ property int c: MyQmlObject.EnumValue3
+ property int d: MyQmlObject.EnumValue4
+
+ // Enums from namespaced type
+ property int e: Namespace.MyQmlObject.EnumValue1
+ property int f: Namespace.MyQmlObject.EnumValue2
+ property int g: Namespace.MyQmlObject.EnumValue3
+ property int h: Namespace.MyQmlObject.EnumValue4
+
+ // Test that enums don't mask attached properties
+ property int i: MyQmlObject.value
+ property int j: Namespace.MyQmlObject.value
+}
diff --git a/tests/auto/declarative/qmlbindengine/extensionObjects.txt b/tests/auto/declarative/qmlbindengine/extensionObjects.txt
new file mode 100644
index 0000000..a902312
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/extensionObjects.txt
@@ -0,0 +1,10 @@
+import Qt.test 1.0
+
+MyExtendedObject
+{
+ baseProperty: baseExtendedProperty
+ baseExtendedProperty: 13
+
+ coreProperty: extendedProperty
+ extendedProperty: 9
+}
diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt
new file mode 100644
index 0000000..ccb3a22
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.1.txt
@@ -0,0 +1,13 @@
+import Qt.test 1.0
+import Qt 4.6
+
+MyQmlObject {
+ objectProperty: if(1) OtherObject
+
+ property var obj
+
+ obj: Object {
+ id: OtherObject
+ }
+}
+
diff --git a/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt
new file mode 100644
index 0000000..6c1fca6
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/idShortcutInvalidates.txt
@@ -0,0 +1,12 @@
+import Qt.test 1.0
+import Qt 4.6
+
+MyQmlObject {
+ objectProperty: OtherObject
+
+ property var obj
+
+ obj: Object {
+ id: OtherObject
+ }
+}
diff --git a/tests/auto/declarative/qmlbindengine/methods.1.txt b/tests/auto/declarative/qmlbindengine/methods.1.txt
new file mode 100644
index 0000000..8ba300f
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/methods.1.txt
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: MyObject
+ onBasicSignal: MyObject.method()
+}
diff --git a/tests/auto/declarative/qmlbindengine/methods.2.txt b/tests/auto/declarative/qmlbindengine/methods.2.txt
new file mode 100644
index 0000000..70911f7
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/methods.2.txt
@@ -0,0 +1,6 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ id: MyObject
+ onBasicSignal: MyObject.method(163)
+}
diff --git a/tests/auto/declarative/qmlbindengine/qmlbindengine.pro b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro
new file mode 100644
index 0000000..4a38ac9
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/qmlbindengine.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+macx:CONFIG -= app_bundle
+SOURCES += tst_qmlbindengine.cpp \
+ testtypes.cpp
+HEADERS += testtypes.h
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt b/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt
new file mode 100644
index 0000000..fbd0914
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/signalAssignment.1.txt
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onBasicSignal: setString('pass')
+}
diff --git a/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt b/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt
new file mode 100644
index 0000000..8addcb9
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/signalAssignment.2.txt
@@ -0,0 +1,5 @@
+import Qt.test 1.0
+
+MyQmlObject {
+ onArgumentSignal: setString('pass ' + a + ' ' + b + ' ' + c)
+}
diff --git a/tests/auto/declarative/qmlbindengine/testtypes.cpp b/tests/auto/declarative/qmlbindengine/testtypes.cpp
new file mode 100644
index 0000000..3ff05d7
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/testtypes.cpp
@@ -0,0 +1,41 @@
+#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, 0, MyQmlObject,MyQmlObject);
+QML_DEFINE_TYPE(Qt.test, 1, 0, 0, MyDeferredObject,MyDeferredObject);
+QML_DEFINE_TYPE(Qt.test, 1, 0, 0, MyQmlContainer,MyQmlContainer);
+QML_DEFINE_EXTENDED_TYPE(Qt.test, 1, 0, 0, MyBaseExtendedObject,MyBaseExtendedObject,BaseExtensionObject);
+QML_DEFINE_EXTENDED_TYPE(Qt.test, 1, 0, 0, MyExtendedObject,MyExtendedObject,ExtensionObject);
+
+#include "testtypes.moc"
diff --git a/tests/auto/declarative/qmlbindengine/testtypes.h b/tests/auto/declarative/qmlbindengine/testtypes.h
new file mode 100644
index 0000000..f27c0b0
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/testtypes.h
@@ -0,0 +1,201 @@
+#ifndef TESTTYPES_H
+#define TESTTYPES_H
+
+#include <QtCore/qobject.h>
+#include <QtDeclarative/qml.h>
+#include <QtDeclarative/qmlexpression.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(bool trueProperty READ trueProperty CONSTANT)
+ Q_PROPERTY(bool falseProperty READ falseProperty CONSTANT)
+ Q_PROPERTY(QString stringProperty READ stringProperty WRITE setStringProperty NOTIFY stringChanged)
+ Q_PROPERTY(QObject *objectProperty READ objectProperty WRITE setObjectProperty NOTIFY objectChanged);
+public:
+ MyQmlObject(): m_methodCalled(false), m_methodIntCalled(false), m_object(0) {}
+
+ 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();
+ }
+
+ 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);
+ }
+signals:
+ void basicSignal();
+ void argumentSignal(int a, QString b, qreal c);
+ void stringChanged();
+ void objectChanged();
+
+public slots:
+ void method() { 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_qmlbindengine;
+ bool m_methodCalled;
+ bool m_methodIntCalled;
+
+ QObject *m_object;
+ QString m_string;
+};
+
+QML_DECLARE_TYPE(MyQmlObject);
+
+class MyQmlContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QList<MyQmlObject*>* children READ children)
+public:
+ MyQmlContainer() {}
+
+ QList<MyQmlObject*> *children() { return &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)
+ {
+ }
+
+ virtual void valueChanged() {
+ changed = true;
+ }
+ 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)
+ 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; }
+
+ 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; }
+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);
+
+#endif // TESTTYPES_H
+
diff --git a/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
new file mode 100644
index 0000000..80373fe
--- /dev/null
+++ b/tests/auto/declarative/qmlbindengine/tst_qmlbindengine.cpp
@@ -0,0 +1,390 @@
+#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 <QtCore/qdir.h>
+#include "testtypes.h"
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
+
+class tst_qmlbindengine : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlbindengine() {}
+
+private slots:
+ 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 enums();
+
+private:
+ QmlEngine engine;
+};
+
+void tst_qmlbindengine::idShortcutInvalidates()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("idShortcutInvalidates.txt"));
+ 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.txt"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->objectProperty() != 0);
+ delete object->objectProperty();
+ QVERIFY(object->objectProperty() == 0);
+ }
+}
+
+void tst_qmlbindengine::boolPropertiesEvaluateAsBool()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.1.txt"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->stringProperty(), QLatin1String("pass"));
+ }
+ {
+ QmlComponent component(&engine, TEST_FILE("boolPropertiesEvaluateAsBool.2.txt"));
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->stringProperty(), QLatin1String("pass"));
+ }
+}
+
+void tst_qmlbindengine::signalAssignment()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("signalAssignment.1.txt"));
+ 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.txt"));
+ 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_qmlbindengine::methods()
+{
+ {
+ QmlComponent component(&engine, TEST_FILE("methods.1.txt"));
+ 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.txt"));
+ 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);
+ }
+}
+
+void tst_qmlbindengine::bindingLoop()
+{
+ QmlComponent component(&engine, TEST_FILE("bindingLoop.txt"));
+ QTest::ignoreMessage(QtWarningMsg, "QML MyQmlObject (unknown location): Binding loop detected for property \"stringProperty\" ");
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qmlbindengine::basicExpressions_data()
+{
+ QTest::addColumn<QString>("expression");
+ QTest::addColumn<QVariant>("result");
+ QTest::addColumn<bool>("nest");
+
+ 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_qmlbindengine::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);
+}
+
+Q_DECLARE_METATYPE(QList<QObject *>);
+void tst_qmlbindengine::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_qmlbindengine::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_qmlbindengine::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_qmlbindengine::deferredProperties()
+{
+ QmlComponent component(&engine, TEST_FILE("deferredProperties.txt"));
+ 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);
+}
+
+void tst_qmlbindengine::extensionObjects()
+{
+ QmlComponent component(&engine, TEST_FILE("extensionObjects.txt"));
+ 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_qmlbindengine::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);
+}
+
+QTEST_MAIN(tst_qmlbindengine)
+
+#include "tst_qmlbindengine.moc"
diff --git a/tests/auto/declarative/qmldom/data/MyComponent.qml b/tests/auto/declarative/qmldom/data/MyComponent.qml
new file mode 100644
index 0000000..1472f01
--- /dev/null
+++ b/tests/auto/declarative/qmldom/data/MyComponent.qml
@@ -0,0 +1,4 @@
+import Qt 4.6
+
+Item {
+}
diff --git a/tests/auto/declarative/qmldom/data/importdir/Bar.qml b/tests/auto/declarative/qmldom/data/importdir/Bar.qml
new file mode 100644
index 0000000..2d1a4a3
--- /dev/null
+++ b/tests/auto/declarative/qmldom/data/importdir/Bar.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+
diff --git a/tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml b/tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml
new file mode 100644
index 0000000..2d1a4a3
--- /dev/null
+++ b/tests/auto/declarative/qmldom/data/importlib/sublib/qmldir/Foo.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+
diff --git a/tests/auto/declarative/qmldom/data/top.qml b/tests/auto/declarative/qmldom/data/top.qml
new file mode 100644
index 0000000..2681993
--- /dev/null
+++ b/tests/auto/declarative/qmldom/data/top.qml
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+MyComponent {
+ width: 100
+ height: 100
+}
diff --git a/tests/auto/declarative/qmldom/qmldom.pro b/tests/auto/declarative/qmldom/qmldom.pro
new file mode 100644
index 0000000..d566354
--- /dev/null
+++ b/tests/auto/declarative/qmldom/qmldom.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+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
new file mode 100644
index 0000000..e1419cc
--- /dev/null
+++ b/tests/auto/declarative/qmldom/tst_qmldom.cpp
@@ -0,0 +1,201 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmldom.h>
+
+#include <QtCore/QDebug>
+#include <QtCore/QFile>
+
+class tst_qmldom : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmldom() {}
+
+private slots:
+ void loadSimple();
+ void loadProperties();
+ void loadChildObject();
+ void loadComposite();
+ void loadImports();
+
+ void testValueSource();
+
+private:
+ QmlEngine engine;
+};
+
+
+void tst_qmldom::loadSimple()
+{
+ QByteArray qml = "import Qt 4.6\n"
+ "Item {}";
+ //QByteArray qml = "<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);
+}
+
+void tst_qmldom::loadProperties()
+{
+ QByteArray qml = "import Qt 4.6\n"
+ "Item { id : item; x : 300; visible : true }";
+ //QByteArray qml = "<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");
+ QVERIFY(xProperty.value().isLiteral());
+ QVERIFY(xProperty.value().toLiteral().literal() == "300");
+
+ QmlDomProperty visibleProperty = rootObject.property("visible");
+ QVERIFY(visibleProperty.propertyName() == "visible");
+ QVERIFY(visibleProperty.value().isLiteral());
+ QVERIFY(visibleProperty.value().toLiteral().literal() == "true");
+}
+
+void tst_qmldom::loadChildObject()
+{
+ QByteArray qml = "import Qt 4.6\n"
+ "Item { Item {} }";
+ //QByteArray qml = "<Item> <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: Follow { 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/Follow");
+
+ 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::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(""));
+}
+
+
+QTEST_MAIN(tst_qmldom)
+
+#include "tst_qmldom.moc"
diff --git a/tests/auto/declarative/qmlengine/functions.qml b/tests/auto/declarative/qmlengine/functions.qml
new file mode 100644
index 0000000..28e8ed4
--- /dev/null
+++ b/tests/auto/declarative/qmlengine/functions.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyTypeObject {
+ rectProperty: Qt.rect(0,0,100,100)
+ rectFProperty: Qt.rect(0,0.5,100,99.5)
+}
diff --git a/tests/auto/declarative/qmlengine/qmlengine.pro b/tests/auto/declarative/qmlengine/qmlengine.pro
new file mode 100644
index 0000000..4ac81e9
--- /dev/null
+++ b/tests/auto/declarative/qmlengine/qmlengine.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmlengine.cpp
+
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/qmlengine/tst_qmlengine.cpp b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
new file mode 100644
index 0000000..8c050cb
--- /dev/null
+++ b/tests/auto/declarative/qmlengine/tst_qmlengine.cpp
@@ -0,0 +1,98 @@
+#include <qtest.h>
+#include <QtDeclarative/qml.h>
+#include <QtDeclarative/QmlComponent>
+#include <QtDeclarative/QmlEngine>
+
+#include <QtCore/QDebug>
+#include <QtCore/QFile>
+#include <QtCore/QUrl>
+
+class tst_qmlengine : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlengine() {}
+
+private slots:
+ void valueTypeFunctions();
+
+private:
+ QmlEngine engine;
+};
+
+class MyTypeObject : public QObject
+{
+ Q_OBJECT
+ 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(QRectF rectFProperty READ rectFProperty WRITE setRectFProperty);
+
+public:
+ MyTypeObject() {}
+
+ 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;
+ }
+
+ QRectF rectFPropertyValue;
+ QRectF rectFProperty() const {
+ return rectFPropertyValue;
+ }
+ void setRectFProperty(const QRectF &v) {
+ rectFPropertyValue = v;
+ }
+
+};
+QML_DECLARE_TYPE(MyTypeObject);
+QML_DEFINE_TYPE(Test, 1, 0, 0, MyTypeObject, MyTypeObject);
+
+void tst_qmlengine::valueTypeFunctions()
+{
+ QmlComponent component(&engine, SRCDIR "/functions.qml");
+ MyTypeObject *obj = qobject_cast<MyTypeObject*>(component.create());
+ QCOMPARE(obj->rectProperty(), QRect(0,0,100,100));
+ QCOMPARE(obj->rectFProperty(), QRectF(0,0.5,100,99.5));
+}
+
+QTEST_MAIN(tst_qmlengine)
+
+#include "tst_qmlengine.moc"
diff --git a/tests/auto/declarative/qmllist/qmllist.pro b/tests/auto/declarative/qmllist/qmllist.pro
new file mode 100644
index 0000000..e5558f1
--- /dev/null
+++ b/tests/auto/declarative/qmllist/qmllist.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmllist.cpp
diff --git a/tests/auto/declarative/qmllist/tst_qmllist.cpp b/tests/auto/declarative/qmllist/tst_qmllist.cpp
new file mode 100644
index 0000000..541ca64
--- /dev/null
+++ b/tests/auto/declarative/qmllist/tst_qmllist.cpp
@@ -0,0 +1,38 @@
+#include <qtest.h>
+#include <QtDeclarative/qml.h>
+#include <QtDeclarative/qmlprivate.h>
+
+class tst_QmlList : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QmlList() {}
+
+private slots:
+ void interface();
+};
+
+void tst_QmlList::interface()
+{
+ QmlConcreteList<QObject*> list;
+ QObject *obj = new QObject;
+ obj->setObjectName("foo");
+ list.append(obj);
+ QVERIFY(list.count() == 1);
+ QCOMPARE(list.at(0), obj);
+
+ QmlPrivate::ListInterface *li = (QmlPrivate::ListInterface*)&list;
+
+ void *ptr[1];
+ li->at(0, ptr);
+ QVERIFY(li->count() == 1);
+ QCOMPARE(ptr[0], obj);
+
+ li->removeAt(0);
+ QVERIFY(li->count() == 0);
+ QVERIFY(list.count() == 0);
+}
+
+QTEST_MAIN(tst_QmlList)
+
+#include "tst_qmllist.moc"
diff --git a/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro
new file mode 100644
index 0000000..4aa0450
--- /dev/null
+++ b/tests/auto/declarative/qmllistaccessor/qmllistaccessor.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmllistaccessor.cpp
diff --git a/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp b/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp
new file mode 100644
index 0000000..f5b57ea
--- /dev/null
+++ b/tests/auto/declarative/qmllistaccessor/tst_qmllistaccessor.cpp
@@ -0,0 +1,61 @@
+#include <qtest.h>
+#include <QtDeclarative/qml.h>
+#include <QtDeclarative/qmllistaccessor.h>
+
+class tst_QmlListAccessor : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QmlListAccessor() {}
+
+private slots:
+ void qmllist();
+ //void qlist();
+ //void qstringlist();
+};
+
+void tst_QmlListAccessor::qmllist()
+{
+ QmlConcreteList<QObject*> list;
+ QObject *obj = new QObject;
+ list.append(obj);
+ QVERIFY(list.count() == 1);
+ QCOMPARE(list.at(0), obj);
+
+ QmlListAccessor accessor;
+ accessor.setList(qVariantFromValue((QmlList<QObject*>*)&list));
+
+ QVERIFY(accessor.isValid());
+ QVERIFY(accessor.count() == 1);
+
+ QVariant v = accessor.at(0);
+ QCOMPARE(qvariant_cast<QObject*>(v), obj);
+
+ accessor.removeAt(3);
+ QVERIFY(accessor.count() == 1);
+
+ accessor.removeAt(0);
+ QVERIFY(accessor.count() == 0);
+
+ accessor.insert(4, qVariantFromValue(obj));
+ QVERIFY(accessor.count() == 1);
+
+ v = accessor.at(0);
+ QCOMPARE(qvariant_cast<QObject*>(v), obj);
+
+ QObject *obj2 = new QObject;
+ accessor.append(qVariantFromValue(obj2));
+ QVERIFY(accessor.count() == 2);
+
+ v = accessor.at(1);
+ QCOMPARE(qvariant_cast<QObject*>(v), obj2);
+
+ accessor.clear();
+ QVERIFY(accessor.count() == 0);
+
+ QVERIFY(accessor.isValid());
+}
+
+QTEST_MAIN(tst_QmlListAccessor)
+
+#include "tst_qmllistaccessor.moc"
diff --git a/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro
new file mode 100644
index 0000000..af67373
--- /dev/null
+++ b/tests/auto/declarative/qmlmetaproperty/qmlmetaproperty.pro
@@ -0,0 +1,3 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmlmetaproperty.cpp
diff --git a/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
new file mode 100644
index 0000000..65d061e
--- /dev/null
+++ b/tests/auto/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -0,0 +1,104 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmlmetaproperty.h>
+#include <QtGui/QLineEdit>
+
+class MyQmlObject : public QObject
+{
+ Q_OBJECT
+public:
+ MyQmlObject() {}
+};
+
+QML_DECLARE_TYPE(MyQmlObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyQmlObject,MyQmlObject);
+
+class MyContainer : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(QList<MyQmlObject*>* children READ children)
+ Q_PROPERTY(QmlList<MyQmlObject*>* qmlChildren READ qmlChildren)
+public:
+ MyContainer() {}
+
+ QList<MyQmlObject*> *children() { return &m_children; }
+ QmlConcreteList<MyQmlObject *> *qmlChildren() { return &m_qmlChildren; }
+
+private:
+ QList<MyQmlObject*> m_children;
+ QmlConcreteList<MyQmlObject *> m_qmlChildren;
+};
+
+QML_DECLARE_TYPE(MyContainer);
+QML_DEFINE_TYPE(Test,1,0,0,MyContainer,MyContainer);
+
+class tst_QmlMetaProperty : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QmlMetaProperty() {}
+
+private slots:
+ void writeObjectToList();
+ void writeListToList();
+ void writeObjectToQmlList();
+
+ //writeToReadOnly();
+
+private:
+ QmlEngine engine;
+};
+
+void tst_QmlMetaProperty::writeObjectToList()
+{
+ QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl());
+ MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->children()->size() == 1);
+
+ MyQmlObject *object = new MyQmlObject;
+ QmlMetaProperty prop(container, "children");
+ prop.write(qVariantFromValue(object));
+ QCOMPARE(container->children()->size(), 2);
+ QCOMPARE(container->children()->at(1), object);
+}
+
+Q_DECLARE_METATYPE(QList<QObject *>);
+void tst_QmlMetaProperty::writeListToList()
+{
+ QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { children: MyQmlObject {} }", QUrl());
+ MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->children()->size() == 1);
+
+ QList<QObject*> objList;
+ objList << new MyQmlObject() << new MyQmlObject() << new MyQmlObject() << new MyQmlObject();
+ QmlMetaProperty prop(container, "children");
+ prop.write(qVariantFromValue(objList));
+ QCOMPARE(container->children()->size(), 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::writeObjectToQmlList()
+{
+ QmlComponent containerComponent(&engine, "import Test 1.0\nMyContainer { qmlChildren: MyQmlObject {} }", QUrl());
+ MyContainer *container = qobject_cast<MyContainer*>(containerComponent.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->qmlChildren()->size() == 1);
+
+ MyQmlObject *object = new MyQmlObject;
+ QmlMetaProperty prop(container, "qmlChildren");
+ prop.write(qVariantFromValue(object));
+ QCOMPARE(container->qmlChildren()->size(), 2);
+ QCOMPARE(container->qmlChildren()->at(1), object);
+}
+
+QTEST_MAIN(tst_QmlMetaProperty)
+
+#include "tst_qmlmetaproperty.moc"
diff --git a/tests/auto/declarative/qmlparser/Alias.qml b/tests/auto/declarative/qmlparser/Alias.qml
new file mode 100644
index 0000000..8264e0d
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/Alias.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+Object {
+ id: Root
+ property int value: 1892
+ property alias aliasValue: Root.value
+}
+
diff --git a/tests/auto/declarative/qmlparser/MyComponent.qml b/tests/auto/declarative/qmlparser/MyComponent.qml
new file mode 100644
index 0000000..1a23277
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/MyComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+
+MyQmlObject {
+ property real x;
+ property real y;
+}
diff --git a/tests/auto/declarative/qmlparser/MyContainerComponent.qml b/tests/auto/declarative/qmlparser/MyContainerComponent.qml
new file mode 100644
index 0000000..61f54c5
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/MyContainerComponent.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+
+MyContainer {
+ property int x
+}
diff --git a/tests/auto/declarative/qmlparser/alias.1.qml b/tests/auto/declarative/qmlparser/alias.1.qml
new file mode 100644
index 0000000..492d99a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/alias.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Qt 4.6
+
+Object {
+ id: Root
+ property int value: 10
+ property alias valueAlias: Root.value
+}
diff --git a/tests/auto/declarative/qmlparser/alias.2.qml b/tests/auto/declarative/qmlparser/alias.2.qml
new file mode 100644
index 0000000..aa4d103
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/alias.2.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+
+MyQmlObject {
+ id: Root
+ property alias aliasObject: Root.qmlobjectProperty
+
+ qmlobjectProperty: MyQmlObject { value : 10 }
+}
diff --git a/tests/auto/declarative/qmlparser/alias.3.qml b/tests/auto/declarative/qmlparser/alias.3.qml
new file mode 100644
index 0000000..e25fbae
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/alias.3.qml
@@ -0,0 +1,10 @@
+import Qt 4.6
+
+Object {
+ property var other
+ other: Alias { id: MyAliasObject }
+
+ property alias value: MyAliasObject.aliasValue
+ property alias value2: MyAliasObject.value
+}
+
diff --git a/tests/auto/declarative/qmlparser/assignBasicTypes.qml b/tests/auto/declarative/qmlparser/assignBasicTypes.qml
new file mode 100644
index 0000000..cef9f8d
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignBasicTypes.qml
@@ -0,0 +1,26 @@
+import Test 1.0
+MyTypeObject {
+ flagProperty: "FlagVal1 | FlagVal3"
+ enumProperty: "EnumVal2"
+ stringProperty: "Hello World!"
+ uintProperty: 10
+ intProperty: -19
+ realProperty: 23.2
+ doubleProperty: -19.7
+ colorProperty: "red"
+ dateProperty: "1982-11-25"
+ timeProperty: "11:11:31"
+ timeProperty: "11:11:32"
+ timeProperty: "11:11:32"
+ dateTimeProperty: "2009-05-12T13:22:01"
+ pointProperty: "99,13"
+ pointFProperty: "-10.1,12.3"
+ sizeProperty: "99x13"
+ sizeFProperty: "0.1x0.2"
+ rectProperty: "9,7,100x200"
+ rectFProperty: "1000.1,-10.9,400x90.99"
+ boolProperty: true
+ variantProperty: "Hello World!"
+
+ objectProperty: MyTypeObject { intProperty: 8 }
+}
diff --git a/tests/auto/declarative/qmlparser/assignLiteralSignalProperty.qml b/tests/auto/declarative/qmlparser/assignLiteralSignalProperty.qml
new file mode 100644
index 0000000..399fcea
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignLiteralSignalProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onLiteralSignal: 10
+}
diff --git a/tests/auto/declarative/qmlparser/assignObjectToSignal.qml b/tests/auto/declarative/qmlparser/assignObjectToSignal.qml
new file mode 100644
index 0000000..789cc66
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignObjectToSignal.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/assignObjectToVariant.qml b/tests/auto/declarative/qmlparser/assignObjectToVariant.qml
new file mode 100644
index 0000000..28c68c4
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignObjectToVariant.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ property var a;
+ a: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/assignQmlComponent.qml b/tests/auto/declarative/qmlparser/assignQmlComponent.qml
new file mode 100644
index 0000000..20bdc55
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignQmlComponent.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ MyComponent { x: 10; y: 11; }
+}
diff --git a/tests/auto/declarative/qmlparser/assignSignal.qml b/tests/auto/declarative/qmlparser/assignSignal.qml
new file mode 100644
index 0000000..153b403
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignSignal.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ onBasicSignal: basicSlot()
+}
diff --git a/tests/auto/declarative/qmlparser/assignTypeExtremes.qml b/tests/auto/declarative/qmlparser/assignTypeExtremes.qml
new file mode 100644
index 0000000..60ede52
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/assignTypeExtremes.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: 4000000000
+ intProperty: -2000000000
+}
diff --git a/tests/auto/declarative/qmlparser/attachedProperties.qml b/tests/auto/declarative/qmlparser/attachedProperties.qml
new file mode 100644
index 0000000..8343754
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/attachedProperties.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ MyQmlObject.value: 10
+}
diff --git a/tests/auto/declarative/qmlparser/autoComponentCreation.qml b/tests/auto/declarative/qmlparser/autoComponentCreation.qml
new file mode 100644
index 0000000..5d00144
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/autoComponentCreation.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ componentProperty : MyTypeObject { realProperty: 9 }
+}
diff --git a/tests/auto/declarative/qmlparser/cppnamespace.qml b/tests/auto/declarative/qmlparser/cppnamespace.qml
new file mode 100644
index 0000000..e1daf3b
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/cppnamespace.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+
+MyNamespacedType {
+}
diff --git a/tests/auto/declarative/qmlparser/customParserIdNotAllowed.errors.txt b/tests/auto/declarative/qmlparser/customParserIdNotAllowed.errors.txt
new file mode 100644
index 0000000..d28c0bd
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/customParserIdNotAllowed.errors.txt
@@ -0,0 +1 @@
+4:19:Cannot use reserved "id" property in ListModel
diff --git a/tests/auto/declarative/qmlparser/customParserIdNotAllowed.qml b/tests/auto/declarative/qmlparser/customParserIdNotAllowed.qml
new file mode 100644
index 0000000..e607768
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/customParserIdNotAllowed.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+ListModel {
+ ListElement { a: 10 }
+ ListElement { id: Foo; a: 12 }
+}
diff --git a/tests/auto/declarative/qmlparser/customParserTypes.qml b/tests/auto/declarative/qmlparser/customParserTypes.qml
new file mode 100644
index 0000000..cf2f272
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/customParserTypes.qml
@@ -0,0 +1,5 @@
+import Qt 4.6
+ListModel {
+ ListElement { a: 10 }
+ ListElement { a: 12 }
+}
diff --git a/tests/auto/declarative/qmlparser/customVariantTypes.qml b/tests/auto/declarative/qmlparser/customVariantTypes.qml
new file mode 100644
index 0000000..0263ed2
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/customVariantTypes.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ customType: "10"
+}
diff --git a/tests/auto/declarative/qmlparser/duplicateIDs.errors.txt b/tests/auto/declarative/qmlparser/duplicateIDs.errors.txt
new file mode 100644
index 0000000..66241cf
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/duplicateIDs.errors.txt
@@ -0,0 +1 @@
+4:19:id is not unique
diff --git a/tests/auto/declarative/qmlparser/duplicateIDs.qml b/tests/auto/declarative/qmlparser/duplicateIDs.qml
new file mode 100644
index 0000000..9605b5b
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/duplicateIDs.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject { id: MyID }
+ MyQmlObject { id: MyID }
+}
+
diff --git a/tests/auto/declarative/qmlparser/dynamicObject.1.qml b/tests/auto/declarative/qmlparser/dynamicObject.1.qml
new file mode 100644
index 0000000..85d1052
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/dynamicObject.1.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+import Qt 4.6
+PropertyChanges {
+ propa: a + 10
+ propb: Math.min(a, 10)
+ propc: MyPropertyValueSource {}
+ onPropA: a
+}
diff --git a/tests/auto/declarative/qmlparser/dynamicProperties.qml b/tests/auto/declarative/qmlparser/dynamicProperties.qml
new file mode 100644
index 0000000..f93e446
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/dynamicProperties.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ default property int intProperty : 10
+ property bool boolProperty: false
+ property double doubleProperty: -10.1
+ property real realProperty: -19.9
+ property string stringProperty: "Hello World!"
+ property color colorProperty: "red"
+ property date dateProperty: "1945-09-02"
+ property var varProperty: "Hello World!"
+ property variant variantProperty: 12
+}
diff --git a/tests/auto/declarative/qmlparser/dynamicSignalsAndSlots.qml b/tests/auto/declarative/qmlparser/dynamicSignalsAndSlots.qml
new file mode 100644
index 0000000..b0ca970
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/dynamicSignalsAndSlots.qml
@@ -0,0 +1,7 @@
+import Qt 4.6
+Object {
+ signal signal1
+ function slot1() {}
+ signal signal2
+ function slot2() {}
+}
diff --git a/tests/auto/declarative/qmlparser/empty.errors.txt b/tests/auto/declarative/qmlparser/empty.errors.txt
new file mode 100644
index 0000000..d416e76
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/empty.errors.txt
@@ -0,0 +1,2 @@
+0:0:Expected token `numeric literal'
+0:0:Expected a qualified name id
diff --git a/tests/auto/declarative/qmlparser/empty.qml b/tests/auto/declarative/qmlparser/empty.qml
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/empty.qml
diff --git a/tests/auto/declarative/qmlparser/failingComponent.errors.txt b/tests/auto/declarative/qmlparser/failingComponent.errors.txt
new file mode 100644
index 0000000..0cf0ef3
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/failingComponent.errors.txt
@@ -0,0 +1 @@
+3:5:Type FailingComponent unavailable
diff --git a/tests/auto/declarative/qmlparser/failingComponentTest.qml b/tests/auto/declarative/qmlparser/failingComponentTest.qml
new file mode 100644
index 0000000..74a6acf
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/failingComponentTest.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ FailingComponent {}
+}
diff --git a/tests/auto/declarative/qmlparser/fakeDotProperty.errors.txt b/tests/auto/declarative/qmlparser/fakeDotProperty.errors.txt
new file mode 100644
index 0000000..e56ad3a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/fakeDotProperty.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property access
diff --git a/tests/auto/declarative/qmlparser/fakeDotProperty.qml b/tests/auto/declarative/qmlparser/fakeDotProperty.qml
new file mode 100644
index 0000000..d971eee
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/fakeDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value.something: "hello"
+}
diff --git a/tests/auto/declarative/qmlparser/finalOverride.errors.txt b/tests/auto/declarative/qmlparser/finalOverride.errors.txt
new file mode 100644
index 0000000..49e06cb
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/finalOverride.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot override FINAL property
diff --git a/tests/auto/declarative/qmlparser/finalOverride.qml b/tests/auto/declarative/qmlparser/finalOverride.qml
new file mode 100644
index 0000000..a84393a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/finalOverride.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ property int value: 10
+}
diff --git a/tests/auto/declarative/qmlparser/idProperty.qml b/tests/auto/declarative/qmlparser/idProperty.qml
new file mode 100644
index 0000000..a413c0b
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/idProperty.qml
@@ -0,0 +1,8 @@
+import Test 1.0
+MyContainer {
+ property var object : MyObjectId
+
+ MyTypeObject {
+ id: "MyObjectId"
+ }
+}
diff --git a/tests/auto/declarative/qmlparser/importNamespaceConflict.errors.txt b/tests/auto/declarative/qmlparser/importNamespaceConflict.errors.txt
new file mode 100644
index 0000000..231998d
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/importNamespaceConflict.errors.txt
@@ -0,0 +1 @@
+4:1:Namespace Rectangle cannot be used as a type
diff --git a/tests/auto/declarative/qmlparser/importNamespaceConflict.qml b/tests/auto/declarative/qmlparser/importNamespaceConflict.qml
new file mode 100644
index 0000000..cd112af
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/importNamespaceConflict.qml
@@ -0,0 +1,4 @@
+import Test 1.0 as Rectangle
+import Qt 4.6
+
+Rectangle { }
diff --git a/tests/auto/declarative/qmlparser/inlineQmlComponents.qml b/tests/auto/declarative/qmlparser/inlineQmlComponents.qml
new file mode 100644
index 0000000..79ceda6
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/inlineQmlComponents.qml
@@ -0,0 +1,10 @@
+import Test 1.0
+import Qt 4.6
+MyContainer {
+ Component {
+ id: MyComponent
+ MyQmlObject {
+ value: 11
+ }
+ }
+}
diff --git a/tests/auto/declarative/qmlparser/interfaceProperty.qml b/tests/auto/declarative/qmlparser/interfaceProperty.qml
new file mode 100644
index 0000000..70879ff
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/interfaceProperty.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+MyQmlObject {
+ interfaceProperty: MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/interfaceQList.qml b/tests/auto/declarative/qmlparser/interfaceQList.qml
new file mode 100644
index 0000000..c87dfae
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/interfaceQList.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyContainer {
+ qlistInterfaces: [
+ MyQmlObject {},
+ MyQmlObject {}
+ ]
+}
diff --git a/tests/auto/declarative/qmlparser/interfaceQmlList.qml b/tests/auto/declarative/qmlparser/interfaceQmlList.qml
new file mode 100644
index 0000000..8392bea
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/interfaceQmlList.qml
@@ -0,0 +1,7 @@
+import Test 1.0
+MyContainer {
+ qmllistInterfaces: [
+ MyQmlObject {},
+ MyQmlObject {}
+ ]
+}
diff --git a/tests/auto/declarative/qmlparser/invalidID.2.errors.txt b/tests/auto/declarative/qmlparser/invalidID.2.errors.txt
new file mode 100644
index 0000000..56e3eeb
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.2.errors.txt
@@ -0,0 +1,2 @@
+3:5:"" is not a valid object id
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.2.qml b/tests/auto/declarative/qmlparser/invalidID.2.qml
new file mode 100644
index 0000000..4fb3b29
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.2.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: ""
+}
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.3.errors.txt b/tests/auto/declarative/qmlparser/invalidID.3.errors.txt
new file mode 100644
index 0000000..bb811cf
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.3.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid use of id property
diff --git a/tests/auto/declarative/qmlparser/invalidID.3.qml b/tests/auto/declarative/qmlparser/invalidID.3.qml
new file mode 100644
index 0000000..6684172
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.3.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id.other: 10
+}
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.4.errors.txt b/tests/auto/declarative/qmlparser/invalidID.4.errors.txt
new file mode 100644
index 0000000..cfe8756
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.4.errors.txt
@@ -0,0 +1 @@
+4:5:Invalid use of id property
diff --git a/tests/auto/declarative/qmlparser/invalidID.4.qml b/tests/auto/declarative/qmlparser/invalidID.4.qml
new file mode 100644
index 0000000..1f15fce
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.4.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyQmlObject {
+ id: Hello
+ id: World
+}
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.5.errors.txt b/tests/auto/declarative/qmlparser/invalidID.5.errors.txt
new file mode 100644
index 0000000..b0a63a0
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.5.errors.txt
@@ -0,0 +1 @@
+4:9:id conflicts with namespace prefix
diff --git a/tests/auto/declarative/qmlparser/invalidID.5.qml b/tests/auto/declarative/qmlparser/invalidID.5.qml
new file mode 100644
index 0000000..0545b0d
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.5.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+import Test 1.0 as Hello
+MyQmlObject {
+ id: Hello
+}
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.6.errors.txt b/tests/auto/declarative/qmlparser/invalidID.6.errors.txt
new file mode 100644
index 0000000..861e3d7
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.6.errors.txt
@@ -0,0 +1 @@
+3:9:id conflicts with type name
diff --git a/tests/auto/declarative/qmlparser/invalidID.6.qml b/tests/auto/declarative/qmlparser/invalidID.6.qml
new file mode 100644
index 0000000..ea34007
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyQmlObject {
+ id: MyQmlObject
+}
+
diff --git a/tests/auto/declarative/qmlparser/invalidID.errors.txt b/tests/auto/declarative/qmlparser/invalidID.errors.txt
new file mode 100644
index 0000000..1ca678c
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.errors.txt
@@ -0,0 +1 @@
+3:5:"1" is not a valid object id
diff --git a/tests/auto/declarative/qmlparser/invalidID.qml b/tests/auto/declarative/qmlparser/invalidID.qml
new file mode 100644
index 0000000..04db3eb
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/invalidID.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ id: 1
+}
diff --git a/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest.qml b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest.qml
new file mode 100644
index 0000000..d8a22a8
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Rectangle {}
diff --git a/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest2.qml b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest2.qml
new file mode 100644
index 0000000..a0706ad
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/InstalledTest2.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Text {}
diff --git a/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/qmldir b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/qmldir
new file mode 100644
index 0000000..ba0b42a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/lib/com/nokia/installedtest/qmldir
@@ -0,0 +1,3 @@
+InstalledTest 1.0-3 InstalledTest.qml
+InstalledTest 1.4 InstalledTest2.qml
+Rectangle 1.5 InstalledTest2.qml
diff --git a/tests/auto/declarative/qmlparser/listAssignment.1.errors.txt b/tests/auto/declarative/qmlparser/listAssignment.1.errors.txt
new file mode 100644
index 0000000..d68d487
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.1.errors.txt
@@ -0,0 +1 @@
+3:24:Cannot assign primitives to lists
diff --git a/tests/auto/declarative/qmlparser/listAssignment.1.qml b/tests/auto/declarative/qmlparser/listAssignment.1.qml
new file mode 100644
index 0000000..4240425
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ qmllistInterfaces: 1
+}
diff --git a/tests/auto/declarative/qmlparser/listAssignment.2.errors.txt b/tests/auto/declarative/qmlparser/listAssignment.2.errors.txt
new file mode 100644
index 0000000..8b40aa3
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.2.errors.txt
@@ -0,0 +1,2 @@
+3:15:Cannot assign primitives to lists
+
diff --git a/tests/auto/declarative/qmlparser/listAssignment.2.qml b/tests/auto/declarative/qmlparser/listAssignment.2.qml
new file mode 100644
index 0000000..e3baadb
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyContainer {
+ children: 2
+}
diff --git a/tests/auto/declarative/qmlparser/listAssignment.3.errors.txt b/tests/auto/declarative/qmlparser/listAssignment.3.errors.txt
new file mode 100644
index 0000000..8c7b7e9
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.3.errors.txt
@@ -0,0 +1 @@
+4:15:Can only assign one binding to lists
diff --git a/tests/auto/declarative/qmlparser/listAssignment.3.qml b/tests/auto/declarative/qmlparser/listAssignment.3.qml
new file mode 100644
index 0000000..00c4c6b
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listAssignment.3.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainer {
+ children: childBinding.expression
+ children: childBinding2.expression
+}
+
diff --git a/tests/auto/declarative/qmlparser/listItemDeleteSelf.qml b/tests/auto/declarative/qmlparser/listItemDeleteSelf.qml
new file mode 100644
index 0000000..fa2e831
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/listItemDeleteSelf.qml
@@ -0,0 +1,38 @@
+import Qt 4.6
+
+Item {
+ ListModel {
+ id: FruitModel
+ ListElement {
+ name: "Apple"
+ cost: 2.45
+ }
+ ListElement {
+ name: "Orange"
+ cost: 3.25
+ }
+ ListElement {
+ name: "Banana"
+ cost: 1.95
+ }
+ }
+
+ Component {
+ id: FruitDelegate
+ Item {
+ width: 200; height: 50
+ Text { text: name }
+ Text { text: '$'+cost; anchors.right: parent.right }
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: FruitModel.remove(index)
+ }
+ }
+ }
+
+ ListView {
+ model: FruitModel
+ delegate: FruitDelegate
+ anchors.fill: parent
+ }
+}
diff --git a/tests/auto/declarative/qmlparser/missingObject.errors.txt b/tests/auto/declarative/qmlparser/missingObject.errors.txt
new file mode 100644
index 0000000..b31b562
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/missingObject.errors.txt
@@ -0,0 +1 @@
+1:10:Expected token `{'
diff --git a/tests/auto/declarative/qmlparser/missingObject.qml b/tests/auto/declarative/qmlparser/missingObject.qml
new file mode 100644
index 0000000..2f17045
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/missingObject.qml
@@ -0,0 +1 @@
+something: 24
diff --git a/tests/auto/declarative/qmlparser/missingSignal.errors.txt b/tests/auto/declarative/qmlparser/missingSignal.errors.txt
new file mode 100644
index 0000000..e243ae5
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/missingSignal.errors.txt
@@ -0,0 +1 @@
+4:5:Cannot assign to non-existant property "onClicked"
diff --git a/tests/auto/declarative/qmlparser/missingSignal.qml b/tests/auto/declarative/qmlparser/missingSignal.qml
new file mode 100644
index 0000000..fd489ca
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/missingSignal.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+import Qt 4.6
+Object {
+ onClicked: print("Hello world!")
+}
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt
new file mode 100644
index 0000000..cfc6fc8
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.1.errors.txt
@@ -0,0 +1 @@
+2:15:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.1.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.1.qml
new file mode 100644
index 0000000..df7406c
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.1.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject { something: 24 }
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.2.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.2.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.2.qml
new file mode 100644
index 0000000..06ccd37
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 24
+}
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.3.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.3.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.3.qml
new file mode 100644
index 0000000..5b08608
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: 1 + 1
+}
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt
new file mode 100644
index 0000000..8b13585
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.4.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant property "something"
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.4.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.4.qml
new file mode 100644
index 0000000..6579191
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ something: ;
+}
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.5.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.5.errors.txt
new file mode 100644
index 0000000..c07f2b9
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.5.errors.txt
@@ -0,0 +1 @@
+3:5:Expected a qualified name id
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.5.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.5.qml
new file mode 100644
index 0000000..37af057
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.5.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ 24
+}
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.6.errors.txt b/tests/auto/declarative/qmlparser/nonexistantProperty.6.errors.txt
new file mode 100644
index 0000000..c02d7bd
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.6.errors.txt
@@ -0,0 +1 @@
+3:5:Cannot assign to non-existant default property
diff --git a/tests/auto/declarative/qmlparser/nonexistantProperty.6.qml b/tests/auto/declarative/qmlparser/nonexistantProperty.6.qml
new file mode 100644
index 0000000..5cd55d0
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nonexistantProperty.6.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/nullDotProperty.errors.txt b/tests/auto/declarative/qmlparser/nullDotProperty.errors.txt
new file mode 100644
index 0000000..07a4094
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nullDotProperty.errors.txt
@@ -0,0 +1 @@
+3:-1:Cannot set properties on obj as it is null
diff --git a/tests/auto/declarative/qmlparser/nullDotProperty.qml b/tests/auto/declarative/qmlparser/nullDotProperty.qml
new file mode 100644
index 0000000..4e36779
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/nullDotProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyDotPropertyObject {
+ obj.value: 1
+}
diff --git a/tests/auto/declarative/qmlparser/propertyValueSource.qml b/tests/auto/declarative/qmlparser/propertyValueSource.qml
new file mode 100644
index 0000000..ad71fcf
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/propertyValueSource.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ intProperty : MyPropertyValueSource {}
+}
diff --git a/tests/auto/declarative/qmlparser/qmlparser.pro b/tests/auto/declarative/qmlparser/qmlparser.pro
new file mode 100644
index 0000000..dda5c61
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/qmlparser.pro
@@ -0,0 +1,9 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_qmlparser.cpp \
+ testtypes.cpp
+HEADERS = testtypes.h
+macx:CONFIG -= app_bundle
+
+# QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage
+# LIBS += -lgcov
diff --git a/tests/auto/declarative/qmlparser/readOnly.1.errors.txt b/tests/auto/declarative/qmlparser/readOnly.1.errors.txt
new file mode 100644
index 0000000..b8c3404
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/readOnly.1.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/declarative/qmlparser/readOnly.1.qml b/tests/auto/declarative/qmlparser/readOnly.1.qml
new file mode 100644
index 0000000..60757bd
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/readOnly.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello World"
+}
diff --git a/tests/auto/declarative/qmlparser/readOnly.2.errors.txt b/tests/auto/declarative/qmlparser/readOnly.2.errors.txt
new file mode 100644
index 0000000..d857a04
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/readOnly.2.errors.txt
@@ -0,0 +1 @@
+3:5:Invalid property assignment: "readOnlyString" is a read-only property
diff --git a/tests/auto/declarative/qmlparser/readOnly.2.qml b/tests/auto/declarative/qmlparser/readOnly.2.qml
new file mode 100644
index 0000000..8f1633c
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/readOnly.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ readOnlyString: "Hello" + "World"
+}
diff --git a/tests/auto/declarative/qmlparser/rootAsQmlComponent.qml b/tests/auto/declarative/qmlparser/rootAsQmlComponent.qml
new file mode 100644
index 0000000..8d72cd3
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/rootAsQmlComponent.qml
@@ -0,0 +1,6 @@
+import Test 1.0
+MyContainerComponent {
+ x: 11
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/simpleBindings.qml b/tests/auto/declarative/qmlparser/simpleBindings.qml
new file mode 100644
index 0000000..74867b3
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/simpleBindings.qml
@@ -0,0 +1,18 @@
+import Test 1.0
+MyTypeObject {
+ id: Me
+ property int v1: 10
+ property int v2: 11
+
+ property int value1
+ property int value2
+ property int value3
+ property int value4
+
+ value1: v1
+ value2: Me.v1
+ value3: v1 + v2
+ value4: Math.min(v1, v2)
+
+ objectProperty: Me
+}
diff --git a/tests/auto/declarative/qmlparser/simpleContainer.qml b/tests/auto/declarative/qmlparser/simpleContainer.qml
new file mode 100644
index 0000000..c3a795f
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/simpleContainer.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyContainer {
+ MyQmlObject {}
+ MyQmlObject {}
+}
diff --git a/tests/auto/declarative/qmlparser/simpleObject.qml b/tests/auto/declarative/qmlparser/simpleObject.qml
new file mode 100644
index 0000000..30c7823
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/simpleObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+MyQmlObject {}
diff --git a/tests/auto/declarative/qmlparser/subdir/Test.qml b/tests/auto/declarative/qmlparser/subdir/Test.qml
new file mode 100644
index 0000000..c4d5905
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/subdir/Test.qml
@@ -0,0 +1,2 @@
+import Qt 4.6
+Rectangle { }
diff --git a/tests/auto/declarative/qmlparser/testtypes.cpp b/tests/auto/declarative/qmlparser/testtypes.cpp
new file mode 100644
index 0000000..c11e195
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/testtypes.cpp
@@ -0,0 +1,10 @@
+#include "testtypes.h"
+
+QML_DEFINE_INTERFACE(MyInterface);
+QML_DEFINE_TYPE(Test,1,0,0,MyQmlObject,MyQmlObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyTypeObject,MyTypeObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyContainer,MyContainer);
+QML_DEFINE_TYPE(Test,1,0,0,MyPropertyValueSource,MyPropertyValueSource);
+QML_DEFINE_TYPE(Test,1,0,0,MyDotPropertyObject,MyDotPropertyObject);
+QML_DEFINE_TYPE(Test,1,0,0,MyNamespacedType,MyNamespace::MyNamespacedType);
+
diff --git a/tests/auto/declarative/qmlparser/testtypes.h b/tests/auto/declarative/qmlparser/testtypes.h
new file mode 100644
index 0000000..e3e9aae
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/testtypes.h
@@ -0,0 +1,431 @@
+#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 <QtDeclarative/qml.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qmlparserstatus.h>
+#include <QtDeclarative/qmlpropertyvaluesource.h>
+
+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);
+
+static QVariant myCustomVariantTypeConverter(const QString &data)
+{
+ MyCustomVariantType rv;
+ rv.a = data.toInt();
+ return QVariant::fromValue(rv);
+}
+
+class MyAttachedObject : public QObject
+{
+ Q_OBJECT
+ Q_PROPERTY(int value READ value WRITE setValue)
+public:
+ MyAttachedObject(QObject *parent) : QObject(parent), m_value(0) {}
+
+ int value() const { return m_value; }
+ void setValue(int v) { m_value = v; }
+
+private:
+ int m_value;
+};
+
+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"); }
+
+signals:
+ void basicSignal();
+
+private:
+ friend class tst_qmlparser;
+ int m_value;
+ MyInterface *m_interface;
+ MyQmlObject *m_qmlobject;
+ MyCustomVariantType m_custom;
+};
+QML_DECLARE_TYPE(MyQmlObject);
+
+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(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);
+
+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;
+ }
+
+ 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;
+ }
+
+ 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(QList<QObject*>* children READ children)
+ Q_PROPERTY(QList<MyInterface*>* qlistInterfaces READ qlistInterfaces)
+ Q_PROPERTY(QmlList<MyInterface*>* qmllistInterfaces READ qmllistInterfaces)
+ Q_CLASSINFO("DefaultProperty", "children");
+public:
+ MyContainer() {}
+
+ QList<QObject*> *children() { return &m_children; }
+ QList<MyInterface *> *qlistInterfaces() { return &m_interfaces; }
+ QmlList<MyInterface *> *qmllistInterfaces() { return &m_qmlinterfaces; }
+ const QmlConcreteList<MyInterface *> &qmllistAccessor() const { return m_qmlinterfaces; }
+
+private:
+ QList<QObject*> m_children;
+ QList<MyInterface *> m_interfaces;
+ QmlConcreteList<MyInterface *> m_qmlinterfaces;
+};
+
+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
+ };
+}
+QML_DECLARE_TYPE(MyNamespace::MyNamespacedType);
+
+#endif // TESTTYPES_H
diff --git a/tests/auto/declarative/qmlparser/tst_qmlparser.cpp b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp
new file mode 100644
index 0000000..b8bd0e7
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/tst_qmlparser.cpp
@@ -0,0 +1,853 @@
+#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 "testtypes.h"
+
+class tst_qmlparser : public QObject
+{
+ Q_OBJECT
+public:
+ tst_qmlparser() {
+ QmlMetaType::registerCustomStringConverter(qMetaTypeId<MyCustomVariantType>(), myCustomVariantTypeConverter);
+ QFileInfo fileInfo(__FILE__);
+ engine.addImportPath(fileInfo.absoluteDir().filePath(QLatin1String("lib")));
+ }
+
+private slots:
+
+ void errors_data();
+ void errors();
+
+ void simpleObject();
+ void simpleContainer();
+ void interfaceProperty();
+ void interfaceQmlList();
+ void interfaceQList();
+ void assignObjectToSignal();
+ void assignObjectToVariant();
+ void assignLiteralSignalProperty();
+ void assignQmlComponent();
+ void assignBasicTypes();
+ void assignTypeExtremes();
+ void customParserTypes();
+ void rootAsQmlComponent();
+ void inlineQmlComponents();
+ void idProperty();
+ void assignSignal();
+ void dynamicProperties();
+ void dynamicSignalsAndSlots();
+ void simpleBindings();
+ void autoComponentCreation();
+ void propertyValueSource();
+ void attachedProperties();
+ void dynamicObjects();
+ void customVariantTypes();
+ void valueTypes();
+ void cppnamespace();
+ void aliasProperties();
+
+ void importsBuiltin_data();
+ void importsBuiltin();
+ void importsLocal_data();
+ void importsLocal();
+ void importsInstalled_data();
+ void importsInstalled();
+ void importsOrder_data();
+ void importsOrder();
+
+ // regression tests for crashes
+ void crash1();
+
+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(errorfile); \
+ QVERIFY(file.open(QIODevice::ReadOnly)); \
+ QByteArray data = file.readAll(); \
+ 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; \
+ QCOMPARE(expected, actual); \
+ }
+
+inline QUrl TEST_FILE(const QString &filename)
+{
+ QFileInfo fileInfo(__FILE__);
+ return QUrl::fromLocalFile(fileInfo.absoluteDir().filePath(filename));
+}
+
+inline QUrl TEST_FILE(const char *filename)
+{
+ return TEST_FILE(QLatin1String(filename));
+}
+
+void tst_qmlparser::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("readOnly.1") << "readOnly.1.qml" << "readOnly.1.errors.txt" << false;
+ QTest::newRow("readOnly.2") << "readOnly.2.qml" << "readOnly.2.errors.txt" << false;
+
+ QTest::newRow("listAssignment.1") << "listAssignment.1.qml" << "listAssignment.1.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("importNamespaceConflict") << "importNamespaceConflict.qml" << "importNamespaceConflict.errors.txt" << false;
+
+ QTest::newRow("customParserIdNotAllowed") << "customParserIdNotAllowed.qml" << "customParserIdNotAllowed.errors.txt" << false;
+}
+
+void tst_qmlparser::errors()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, errorFile);
+ QFETCH(bool, create);
+
+ QmlComponent component(&engine, TEST_FILE(file));
+
+ if(create) {
+ QObject *object = component.create();
+ QVERIFY(object == 0);
+ }
+
+ VERIFY_ERRORS(errorFile.toLatin1().constData());
+}
+
+void tst_qmlparser::simpleObject()
+{
+ QmlComponent component(&engine, TEST_FILE("simpleObject.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+}
+
+void tst_qmlparser::simpleContainer()
+{
+ QmlComponent component(&engine, TEST_FILE("simpleContainer.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QCOMPARE(container->children()->count(),2);
+}
+
+void tst_qmlparser::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_qmlparser::interfaceQmlList()
+{
+ QmlComponent component(&engine, TEST_FILE("interfaceQmlList.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->qmllistAccessor().count() == 2);
+ for(int ii = 0; ii < 2; ++ii)
+ QVERIFY(container->qmllistAccessor().at(ii)->id == 913);
+}
+
+void tst_qmlparser::interfaceQList()
+{
+ QmlComponent component(&engine, TEST_FILE("interfaceQList.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *container= qobject_cast<MyContainer*>(component.create());
+ QVERIFY(container != 0);
+ QVERIFY(container->qlistInterfaces()->count() == 2);
+ for(int ii = 0; ii < 2; ++ii)
+ QVERIFY(container->qlistInterfaces()->at(ii)->id == 913);
+}
+
+void tst_qmlparser::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_qmlparser::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_qmlparser::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_qmlparser::assignQmlComponent()
+{
+ QmlComponent component(&engine, TEST_FILE("assignQmlComponent.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QVERIFY(object->children()->count() == 1);
+ QObject *child = object->children()->at(0);
+ QCOMPARE(child->property("x"), QVariant(10));
+ QCOMPARE(child->property("y"), QVariant(11));
+}
+
+// Test literal assignment to all the basic types
+void tst_qmlparser::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(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!"));
+ 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_qmlparser::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);
+}
+
+// Tests that custom parser types can be instantiated
+void tst_qmlparser::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_qmlparser::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->children()->count(), 2);
+}
+
+// Tests that components can be specified inline
+void tst_qmlparser::inlineQmlComponents()
+{
+ QmlComponent component(&engine, TEST_FILE("inlineQmlComponents.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->children()->count(), 1);
+ QmlComponent *comp = qobject_cast<QmlComponent *>(object->children()->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_qmlparser::idProperty()
+{
+ QmlComponent component(&engine, TEST_FILE("idProperty.qml"));
+ VERIFY_ERRORS(0);
+ MyContainer *object = qobject_cast<MyContainer *>(component.create());
+ QVERIFY(object != 0);
+ QCOMPARE(object->children()->count(), 1);
+ MyTypeObject *child =
+ qobject_cast<MyTypeObject *>(object->children()->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_qmlparser::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();
+}
+
+// Tests the creation and assignment of dynamic properties
+void tst_qmlparser::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("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));
+}
+
+// Tests the declaration of dynamic signals and slots
+void tst_qmlparser::dynamicSignalsAndSlots()
+{
+ 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);
+}
+
+void tst_qmlparser::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_qmlparser::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_qmlparser::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) {
+ QmlType *type = QmlMetaType::qmlType(child->metaObject());
+ if (type && type->propertyValueSourceCast() != -1)
+ 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_qmlparser::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));
+}
+
+// Tests non-static object properties
+void tst_qmlparser::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_qmlparser::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_qmlparser::valueTypes()
+{
+ QmlComponent component(&engine, TEST_FILE("valueTypes.qml"));
+ VERIFY_ERRORS(0);
+ 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);
+
+ QmlMetaProperty p = QmlMetaProperty::createProperty(object, "rectProperty.x");
+ QCOMPARE(p.read(), QVariant(12));
+ p.write(13);
+ QCOMPARE(p.read(), QVariant(13));
+
+ quint32 r = p.save();
+ QmlMetaProperty p2;
+ p2.restore(r, object);
+ QCOMPARE(p2.read(), QVariant(13));
+}
+
+void tst_qmlparser::cppnamespace()
+{
+ QmlComponent component(&engine, TEST_FILE("cppnamespace.qml"));
+ VERIFY_ERRORS(0);
+ QObject *object = component.create();
+ QVERIFY(object != 0);
+ delete object;
+}
+
+void tst_qmlparser::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;
+ }
+
+}
+
+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) {}
+};
+
+// Check that first child of qml is of given type. Empty type insists on error.
+void tst_qmlparser::testType(const QString& qml, const QString& type)
+{
+ QmlComponent component(&engine, qml.toUtf8(), TEST_FILE("empty.qml")); // just a file for relative local imports
+
+ 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, 1, 0, 3, Test, TestType)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 5, 7, Test, TestType)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 8, 9, Test, TestType2)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 12, 13, Test, TestType2)
+QML_DEFINE_TYPE(com.nokia.Test, 1, 9, 11, OldTest, TestType)
+
+void tst_qmlparser::importsBuiltin_data()
+{
+ 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 1.0")
+ << "import com.nokia.Test 1.0\n"
+ "Test {}"
+ << "TestType";
+ QTest::newRow("qualified wrong")
+ << "import com.nokia.Test 1.0 as T\n"
+ "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("not in version 1.4")
+ << "import com.nokia.Test 1.4\n"
+ "Test {}"
+ << "";
+ 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("not in version 1.10")
+ << "import com.nokia.Test 1.10\n"
+ "Test {}"
+ << "";
+ QTest::newRow("back 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("no old in version 1.12")
+ << "import com.nokia.Test 1.12\n"
+ "OldTest {}"
+ << "";
+ 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";
+ QTest::newRow("qualified multiversion 5")
+ << "import com.nokia.Test 1.0 as T0\n"
+ "import com.nokia.Test 1.10 as T10\n"
+ "T10.Test {}"
+ << "";
+}
+
+void tst_qmlparser::importsBuiltin()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmlparser::importsLocal_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ // import locals
+ QTest::newRow("local import")
+ << "import \"subdir\"\n"
+ "Test {}"
+ << "QFxRect";
+ QTest::newRow("local import as")
+ << "import \"subdir\" as T\n"
+ "T.Test {}"
+ << "QFxRect";
+ 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_qmlparser::importsLocal()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmlparser::importsInstalled_data()
+{
+ QTest::addColumn<QString>("qml");
+ QTest::addColumn<QString>("type");
+
+ // import installed
+ QTest::newRow("installed import")
+ << "import com.nokia.installedtest 1.0\n"
+ "InstalledTest {}"
+ << "QFxRect";
+ QTest::newRow("installed import")
+ << "import com.nokia.installedtest 1.4\n"
+ "InstalledTest {}"
+ << "QFxText";
+}
+
+void tst_qmlparser::importsInstalled()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+
+void tst_qmlparser::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 {}"
+ << "QFxText";
+ QTest::newRow("installed import overrides 2") <<
+ "import com.nokia.installedtest 1.4\n"
+ "import com.nokia.installedtest 1.0\n"
+ "InstalledTest {}"
+ << "QFxRect";
+ 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 {}"
+ << "QFxText";
+ 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 {}"
+ << "QFxRect";
+
+ QTest::newRow("installed import versus builtin 1") <<
+ "import com.nokia.installedtest 1.5\n"
+ "import Qt 4.6\n"
+ "Rectangle {}"
+ << "QFxRect";
+ QTest::newRow("installed import versus builtin 2") <<
+ "import Qt 4.6\n"
+ "import com.nokia.installedtest 1.5\n"
+ "Rectangle {}"
+ << "QFxText";
+ 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 {}"
+ << "QFxImage";
+}
+
+void tst_qmlparser::importsOrder()
+{
+ QFETCH(QString, qml);
+ QFETCH(QString, type);
+ testType(qml,type);
+}
+
+void tst_qmlparser::crash1()
+{
+ QmlComponent component(&engine, "Component {}");
+}
+
+QTEST_MAIN(tst_qmlparser)
+
+#include "tst_qmlparser.moc"
diff --git a/tests/auto/declarative/qmlparser/unregisteredObject.errors.txt b/tests/auto/declarative/qmlparser/unregisteredObject.errors.txt
new file mode 100644
index 0000000..bc4f7f4
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/unregisteredObject.errors.txt
@@ -0,0 +1 @@
+2:1:Type UnregisteredObject unavailable
diff --git a/tests/auto/declarative/qmlparser/unregisteredObject.qml b/tests/auto/declarative/qmlparser/unregisteredObject.qml
new file mode 100644
index 0000000..9498e31
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/unregisteredObject.qml
@@ -0,0 +1,2 @@
+import Test 1.0
+UnregisteredObject {}
diff --git a/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt b/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt
new file mode 100644
index 0000000..3a90a7d
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/unsupportedProperty.errors.txt
@@ -0,0 +1 @@
+3:13:Invalid property assignment: unknown type QVariant::QMatrix
diff --git a/tests/auto/declarative/qmlparser/unsupportedProperty.qml b/tests/auto/declarative/qmlparser/unsupportedProperty.qml
new file mode 100644
index 0000000..9f19680
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/unsupportedProperty.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ matrix: "1,0,0,0,1,0,0,0,1"
+}
diff --git a/tests/auto/declarative/qmlparser/valueTypes.qml b/tests/auto/declarative/qmlparser/valueTypes.qml
new file mode 100644
index 0000000..bf325a7
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/valueTypes.qml
@@ -0,0 +1,13 @@
+import Test 1.0
+MyTypeObject {
+ rectProperty.x: 10
+ rectProperty.y: 11
+ rectProperty.width: rectProperty.x + 2
+ rectProperty.height: 13
+
+ intProperty: rectProperty.x
+
+ onAction: { var a = rectProperty; a.x = 12; }
+
+ rectProperty2: rectProperty
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.1.errors.txt b/tests/auto/declarative/qmlparser/wrongType.1.errors.txt
new file mode 100644
index 0000000..ba7a076
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.1.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.1.qml b/tests/auto/declarative/qmlparser/wrongType.1.qml
new file mode 100644
index 0000000..289d37f
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.1.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "hello"
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.10.errors.txt b/tests/auto/declarative/qmlparser/wrongType.10.errors.txt
new file mode 100644
index 0000000..ae75b52
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.10.errors.txt
@@ -0,0 +1 @@
+3:23:Invalid property assignment: datetime expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.10.qml b/tests/auto/declarative/qmlparser/wrongType.10.qml
new file mode 100644
index 0000000..2cf0e50
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.10.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateTimeProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.11.errors.txt b/tests/auto/declarative/qmlparser/wrongType.11.errors.txt
new file mode 100644
index 0000000..23a4cda
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.11.errors.txt
@@ -0,0 +1 @@
+3:20:Invalid property assignment: point expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.11.qml b/tests/auto/declarative/qmlparser/wrongType.11.qml
new file mode 100644
index 0000000..ae77ba1
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.11.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ pointProperty: "apples"
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.12.errors.txt b/tests/auto/declarative/qmlparser/wrongType.12.errors.txt
new file mode 100644
index 0000000..3092100
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.12.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: size expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.12.qml b/tests/auto/declarative/qmlparser/wrongType.12.qml
new file mode 100644
index 0000000..b7a366f
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.12.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ sizeProperty: "red"
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.13.errors.txt b/tests/auto/declarative/qmlparser/wrongType.13.errors.txt
new file mode 100644
index 0000000..ba7a076
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.13.errors.txt
@@ -0,0 +1 @@
+3:12:Invalid property assignment: int expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.13.qml b/tests/auto/declarative/qmlparser/wrongType.13.qml
new file mode 100644
index 0000000..477aff1
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.13.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ value: "12"
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.14.errors.txt b/tests/auto/declarative/qmlparser/wrongType.14.errors.txt
new file mode 100644
index 0000000..d621fdd
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.14.errors.txt
@@ -0,0 +1 @@
+3:21:Invalid property assignment: string expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.14.qml b/tests/auto/declarative/qmlparser/wrongType.14.qml
new file mode 100644
index 0000000..672d693
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.14.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ stringProperty: 10
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.2.errors.txt b/tests/auto/declarative/qmlparser/wrongType.2.errors.txt
new file mode 100644
index 0000000..9ff9f25
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.2.errors.txt
@@ -0,0 +1 @@
+3:14:Invalid property assignment: boolean expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.2.qml b/tests/auto/declarative/qmlparser/wrongType.2.qml
new file mode 100644
index 0000000..34b74f7
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.2.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ enabled: 5
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.3.errors.txt b/tests/auto/declarative/qmlparser/wrongType.3.errors.txt
new file mode 100644
index 0000000..6d971c6
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.3.errors.txt
@@ -0,0 +1 @@
+3:11:Invalid property assignment: rect expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.3.qml b/tests/auto/declarative/qmlparser/wrongType.3.qml
new file mode 100644
index 0000000..384181a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.3.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyQmlObject {
+ rect: "5,5x10"
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.4.errors.txt b/tests/auto/declarative/qmlparser/wrongType.4.errors.txt
new file mode 100644
index 0000000..ef34d0e
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.4.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unknown enumeration
diff --git a/tests/auto/declarative/qmlparser/wrongType.4.qml b/tests/auto/declarative/qmlparser/wrongType.4.qml
new file mode 100644
index 0000000..0787bf5
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.4.qml
@@ -0,0 +1,4 @@
+import Test 1.0
+MyTypeObject {
+ enumProperty: "InvalidEnumName"
+}
diff --git a/tests/auto/declarative/qmlparser/wrongType.5.errors.txt b/tests/auto/declarative/qmlparser/wrongType.5.errors.txt
new file mode 100644
index 0000000..cab10bd
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.5.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: unsigned int expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.5.qml b/tests/auto/declarative/qmlparser/wrongType.5.qml
new file mode 100644
index 0000000..c50ae9a
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.5.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ uintProperty: -13
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.6.errors.txt b/tests/auto/declarative/qmlparser/wrongType.6.errors.txt
new file mode 100644
index 0000000..d0a0b00
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.6.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: double expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.6.qml b/tests/auto/declarative/qmlparser/wrongType.6.qml
new file mode 100644
index 0000000..da10b78
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.6.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ realProperty: "Hello"
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.7.errors.txt b/tests/auto/declarative/qmlparser/wrongType.7.errors.txt
new file mode 100644
index 0000000..614346b
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.7.errors.txt
@@ -0,0 +1 @@
+3:20:Invalid property assignment: color expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.7.qml b/tests/auto/declarative/qmlparser/wrongType.7.qml
new file mode 100644
index 0000000..ddc3835
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.7.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ colorProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.8.errors.txt b/tests/auto/declarative/qmlparser/wrongType.8.errors.txt
new file mode 100644
index 0000000..1773c00
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.8.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: date expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.8.qml b/tests/auto/declarative/qmlparser/wrongType.8.qml
new file mode 100644
index 0000000..a5f6756
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.8.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ dateProperty: 12
+}
+
diff --git a/tests/auto/declarative/qmlparser/wrongType.9.errors.txt b/tests/auto/declarative/qmlparser/wrongType.9.errors.txt
new file mode 100644
index 0000000..8630975
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.9.errors.txt
@@ -0,0 +1 @@
+3:19:Invalid property assignment: time expected
diff --git a/tests/auto/declarative/qmlparser/wrongType.9.qml b/tests/auto/declarative/qmlparser/wrongType.9.qml
new file mode 100644
index 0000000..a3db732
--- /dev/null
+++ b/tests/auto/declarative/qmlparser/wrongType.9.qml
@@ -0,0 +1,5 @@
+import Test 1.0
+MyTypeObject {
+ timeProperty: 12
+}
+
diff --git a/tests/auto/declarative/repeater/data/repeater.qml b/tests/auto/declarative/repeater/data/repeater.qml
new file mode 100644
index 0000000..57ba9dc
--- /dev/null
+++ b/tests/auto/declarative/repeater/data/repeater.qml
@@ -0,0 +1,22 @@
+import Qt 4.6
+
+Rectangle {
+ id: container
+ objectName: "container"
+ width: 240
+ height: 320
+ color: "white"
+ Repeater {
+ id: repeater
+ objectName: "repeater"
+ width: 240
+ height: 320
+ model: testData
+ Component {
+ Text {
+ y: index*20
+ text: modelData
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/repeater/repeater.pro b/tests/auto/declarative/repeater/repeater.pro
new file mode 100644
index 0000000..0ecd7ee
--- /dev/null
+++ b/tests/auto/declarative/repeater/repeater.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_repeater.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/repeater/tst_repeater.cpp b/tests/auto/declarative/repeater/tst_repeater.cpp
new file mode 100644
index 0000000..08f9154
--- /dev/null
+++ b/tests/auto/declarative/repeater/tst_repeater.cpp
@@ -0,0 +1,91 @@
+#include <QtTest/QtTest>
+#include <qlistmodelinterface.h>
+#include <qfxview.h>
+#include <qfxrepeater.h>
+#include <qfxtext.h>
+#include <qmlcontext.h>
+
+class tst_QFxRepeater : public QObject
+{
+ Q_OBJECT
+public:
+ tst_QFxRepeater();
+
+private slots:
+ void stringList();
+
+private:
+ QFxView *createView(const QString &filename);
+ template<typename T>
+ T *findItem(QObject *parent, const QString &id);
+};
+
+tst_QFxRepeater::tst_QFxRepeater()
+{
+}
+
+void tst_QFxRepeater::stringList()
+{
+ QFxView *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();
+
+ QFxRepeater *repeater = findItem<QFxRepeater>(canvas->root(), "repeater");
+ QVERIFY(repeater != 0);
+
+ QFxItem *container = findItem<QFxItem>(canvas->root(), "container");
+ QVERIFY(container != 0);
+
+ QCOMPARE(container->childItems().count(), data.count() + 1);
+
+ for (int i = 1; i < container->childItems().count(); ++i) {
+ QFxText *name = qobject_cast<QFxText*>(container->childItems().at(i));
+ QVERIFY(name != 0);
+ QCOMPARE(name->text(), data.at(i-1));
+ }
+
+ delete canvas;
+}
+
+
+QFxView *tst_QFxRepeater::createView(const QString &filename)
+{
+ QFxView *canvas = new QFxView(0);
+ canvas->setFixedSize(240,320);
+
+ QFile file(filename);
+ file.open(QFile::ReadOnly);
+ QString qml = file.readAll();
+ canvas->setQml(qml, filename);
+
+ return canvas;
+}
+
+template<typename T>
+T *tst_QFxRepeater::findItem(QObject *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->children().count(); ++i) {
+ QFxItem *item = findItem<T>(parent->children().at(i), objectName);
+ if (item)
+ return static_cast<T*>(item);
+ }
+
+ return 0;
+}
+
+QTEST_MAIN(tst_QFxRepeater)
+
+#include "tst_repeater.moc"
diff --git a/tests/auto/declarative/sql/data/test1.js b/tests/auto/declarative/sql/data/test1.js
new file mode 100644
index 0000000..2ae9988
--- /dev/null
+++ b/tests/auto/declarative/sql/data/test1.js
@@ -0,0 +1,18 @@
+var db;
+db = openDatabase("QmlTestDB", "", "Test database from Qt autotests", 1000000);
+var r="testerror";
+
+// Asynchronous in WebKit, so must wait before calling test()
+db.transaction(function(tx) {
+ r = "passed";
+ tx.executeSql('CREATE TABLE IF NOT EXISTS Greeting(salutation TEXT, salutee TEXT)', [],
+ function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message });
+ tx.executeSql('INSERT INTO Greeting VALUES(?, ?)', [ 'hello', 'world' ],
+ function(tx, rs) { }, function(tx, error) { r="FAILED: "+error.message });
+}, function(tx, error) { r="TXFAILED: "+error.message }, function(tx, result) { if (r=="testerror") r="passed" });
+
+
+function test()
+{
+ return r;
+}
diff --git a/tests/auto/declarative/sql/tst_sql.cpp b/tests/auto/declarative/sql/tst_sql.cpp
new file mode 100644
index 0000000..3179c99
--- /dev/null
+++ b/tests/auto/declarative/sql/tst_sql.cpp
@@ -0,0 +1,108 @@
+#include <qtest.h>
+#include "../../../shared/util.h"
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxtext.h>
+#include <QtWebKit/qwebpage.h>
+#include <QtWebKit/qwebframe.h>
+#include <QtWebKit/qwebdatabase.h>
+#include <QtWebKit/qwebsecurityorigin.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qfile.h>
+
+class tst_sql : public QObject
+{
+ Q_OBJECT
+public:
+ tst_sql() {}
+
+private slots:
+ void verifyAgainstWebKit_data();
+ void verifyAgainstWebKit();
+
+private:
+ QmlEngine engine;
+};
+
+class QWebPageWithJavaScriptConsoleMessages : public QWebPage {
+public:
+ void javaScriptConsoleMessage(const QString& message, int lineNumber, const QString& sourceID)
+ {
+qDebug() << sourceID << ":" << lineNumber << ":" << message;
+ }
+};
+
+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_sql::verifyAgainstWebKit_data()
+{
+ QTest::addColumn<QString>("jsfile"); // The input file
+ QTest::addColumn<QString>("result"); // The required output from the js test() function
+ QTest::addColumn<int>("databases"); // The number of databases that should have been created
+
+ QTest::newRow("basic creation") << "data/test1.js" << "passed" << 1;
+}
+
+void tst_sql::verifyAgainstWebKit()
+{
+ // Tests QML SQL Database support, and tests the same thing against
+ // WebKit (HTML5) support to validate the test.
+ //
+ // WebKit SQL is asynchronous, so tests are divided into code plus a test()
+ // function which is executed "later" (via QTRY_).
+ //
+ QFETCH(QString, jsfile);
+ QFETCH(QString, result);
+ QFETCH(int, databases);
+
+ QString tmpdir = QString(SRCDIR)+"/output";
+
+ // QML...
+ QString qml=
+ "import Qt 4.6\n"
+ "Text { Script { source: \""+jsfile+"\" } text: test() }";
+
+ // Check default storage path (we can't use it since we don't want to mess with user's data)
+ QVERIFY(engine.offlineStoragePath().contains("Nokia"));
+ QVERIFY(engine.offlineStoragePath().contains("OfflineStorage"));
+ engine.setOfflineStoragePath(tmpdir);
+ QmlComponent component(&engine, qml.toUtf8(), QUrl::fromLocalFile(SRCDIR "/empty.qml")); // just a file for relative local imports
+ QFxText *text = qobject_cast<QFxText*>(component.create());
+ QVERIFY(text != 0);
+ QCOMPARE(text->text(),result);
+ QCOMPARE(QDir(tmpdir+"/Databases").entryInfoList(QDir::Files|QDir::NoDotAndDotDot).count(), databases*2); // *2 = .ini file + .sqlite file
+
+ // WebKit...
+ QFile f(jsfile);
+ QVERIFY(f.open(QIODevice::ReadOnly));
+ QString js=f.readAll();
+
+ QWebPageWithJavaScriptConsoleMessages webpage;
+ QDir().mkpath(tmpdir);
+ webpage.settings()->setOfflineStoragePath(tmpdir);
+ webpage.mainFrame()->evaluateJavaScript(js);
+ QTest::qWait(200); // WebKit db access is asynchronous
+ QTRY_COMPARE(webpage.mainFrame()->evaluateJavaScript("test()").toString(),result);
+
+ QWebSecurityOrigin origin = webpage.mainFrame()->securityOrigin();
+ QList<QWebDatabase> dbs = origin.databases();
+ QCOMPARE(dbs.count(), databases);
+
+
+ removeRecursive(tmpdir);
+}
+
+QTEST_MAIN(tst_sql)
+
+#include "tst_sql.moc"
diff --git a/tests/auto/declarative/states/data/basicBinding.qml b/tests/auto/declarative/states/data/basicBinding.qml
new file mode 100644
index 0000000..930a6b2
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicBinding.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: sourceColor }
+ }
+}
diff --git a/tests/auto/declarative/states/data/basicBinding2.qml b/tests/auto/declarative/states/data/basicBinding2.qml
new file mode 100644
index 0000000..6bfaf5a
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicBinding2.qml
@@ -0,0 +1,12 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+
+ property color sourceColor: "red"
+ width: 100; height: 100
+ color: sourceColor
+ states: State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/data/basicBinding3.qml b/tests/auto/declarative/states/data/basicBinding3.qml
new file mode 100644
index 0000000..344bfae
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicBinding3.qml
@@ -0,0 +1,13 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+
+ property color sourceColor: "red"
+ property color sourceColor2: "blue"
+ width: 100; height: 100
+ color: sourceColor
+ states: State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: sourceColor2 }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/data/basicBinding4.qml b/tests/auto/declarative/states/data/basicBinding4.qml
new file mode 100644
index 0000000..f0b72bd
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicBinding4.qml
@@ -0,0 +1,17 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+
+ property color sourceColor: "blue"
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: sourceColor }
+ },
+ State {
+ name: "green"
+ PropertyChanges { target: MyRectangle; color: "green" }
+ }]
+}
diff --git a/tests/auto/declarative/states/data/basicChanges.qml b/tests/auto/declarative/states/data/basicChanges.qml
new file mode 100644
index 0000000..8d560c6
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicChanges.qml
@@ -0,0 +1,10 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+ width: 100; height: 100
+ color: "red"
+ states: State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ }
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/data/basicChanges2.qml b/tests/auto/declarative/states/data/basicChanges2.qml
new file mode 100644
index 0000000..0f8783a
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicChanges2.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ },
+ State {
+ name: "green"
+ PropertyChanges { target: MyRectangle; color: "green" }
+ }]
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/data/basicChanges3.qml b/tests/auto/declarative/states/data/basicChanges3.qml
new file mode 100644
index 0000000..2a5ca5d
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicChanges3.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ },
+ State {
+ name: "bordered"
+ PropertyChanges { target: MyRectangle; border.width: 2 }
+ }]
+}
diff --git a/tests/auto/declarative/states/data/basicExtension.qml b/tests/auto/declarative/states/data/basicExtension.qml
new file mode 100644
index 0000000..230e00b
--- /dev/null
+++ b/tests/auto/declarative/states/data/basicExtension.qml
@@ -0,0 +1,16 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ },
+ State {
+ name: "bordered"
+ extend: "blue"
+ PropertyChanges { target: MyRectangle; border.width: 2 }
+ }]
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/data/fakeExtension.qml b/tests/auto/declarative/states/data/fakeExtension.qml
new file mode 100644
index 0000000..3d85c4f
--- /dev/null
+++ b/tests/auto/declarative/states/data/fakeExtension.qml
@@ -0,0 +1,16 @@
+import Qt 4.6
+Rectangle {
+ id: MyRectangle
+ width: 100; height: 100
+ color: "red"
+ states: [
+ State {
+ name: "blue"
+ PropertyChanges { target: MyRectangle; color: "blue" }
+ },
+ State {
+ name: "green"
+ extend: "blue"
+ PropertyChanges { target: MyRectangle; color: "green" }
+ }]
+} \ No newline at end of file
diff --git a/tests/auto/declarative/states/states.pro b/tests/auto/declarative/states/states.pro
new file mode 100644
index 0000000..0474ea5
--- /dev/null
+++ b/tests/auto/declarative/states/states.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_states.cpp
+
+# Define SRCDIR equal to test's source directory
+DEFINES += SRCDIR=\\\"$$PWD\\\"
diff --git a/tests/auto/declarative/states/tst_states.cpp b/tests/auto/declarative/states/tst_states.cpp
new file mode 100644
index 0000000..3a61bd6
--- /dev/null
+++ b/tests/auto/declarative/states/tst_states.cpp
@@ -0,0 +1,267 @@
+#include <qtest.h>
+#include <QtDeclarative/qmlengine.h>
+#include <QtDeclarative/qmlcomponent.h>
+#include <QtDeclarative/qfxrect.h>
+
+class tst_states : public QObject
+{
+ Q_OBJECT
+public:
+ tst_states() {}
+
+private slots:
+ void basicChanges();
+ void basicExtension();
+ void basicBinding();
+};
+
+void tst_states::basicChanges()
+{
+ QmlEngine engine;
+
+ {
+ QmlComponent rectComponent(&engine, SRCDIR "/data/basicChanges.qml");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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_states::basicExtension()
+{
+ QmlEngine engine;
+
+ {
+ QmlComponent rectComponent(&engine, SRCDIR "/data/basicExtension.qml");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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_states::basicBinding()
+{
+ QmlEngine engine;
+
+ {
+ QmlComponent rectComponent(&engine, SRCDIR "/data/basicBinding.qml");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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");
+ QFxRect *rect = qobject_cast<QFxRect*>(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"));
+ }
+}
+
+QTEST_MAIN(tst_states)
+
+#include "tst_states.moc"
diff --git a/tests/auto/declarative/visual/ListView/basic1/basic1.qml b/tests/auto/declarative/visual/ListView/basic1/basic1.qml
new file mode 100644
index 0000000..b1309ca
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic1/basic1.qml
@@ -0,0 +1,27 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 200
+ height: 300
+ id: Page
+ ListView {
+ anchors.fill: parent
+ delegate: Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ model: ListModel {
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png
new file mode 100644
index 0000000..f8a4830
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic1/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic1/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic1/test b/tests/auto/declarative/visual/ListView/basic1/test
new file mode 100644
index 0000000..49fcf5a
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic1/test
@@ -0,0 +1 @@
+basic1.qml
diff --git a/tests/auto/declarative/visual/ListView/basic2/basic2.qml b/tests/auto/declarative/visual/ListView/basic2/basic2.qml
new file mode 100644
index 0000000..fa20332
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic2/basic2.qml
@@ -0,0 +1,31 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 200
+ height: 300
+ id: Page
+ Component {
+ id: Delegate
+ Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+ ListView {
+ anchors.fill: parent
+ delegate: Delegate
+ model: ListModel {
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png
new file mode 100644
index 0000000..f8a4830
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic2/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic2/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic2/test b/tests/auto/declarative/visual/ListView/basic2/test
new file mode 100644
index 0000000..eb79495
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic2/test
@@ -0,0 +1 @@
+basic2.qml
diff --git a/tests/auto/declarative/visual/ListView/basic3/basic3.qml b/tests/auto/declarative/visual/ListView/basic3/basic3.qml
new file mode 100644
index 0000000..aee252f
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic3/basic3.qml
@@ -0,0 +1,29 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 200
+ height: 300
+ id: Page
+ ListModel {
+ id: Model
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ ListView {
+ anchors.fill: parent
+ model: Model
+ delegate: Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png
new file mode 100644
index 0000000..f8a4830
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic3/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic3/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic3/test b/tests/auto/declarative/visual/ListView/basic3/test
new file mode 100644
index 0000000..9ec306b
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic3/test
@@ -0,0 +1 @@
+basic3.qml
diff --git a/tests/auto/declarative/visual/ListView/basic4/basic4.qml b/tests/auto/declarative/visual/ListView/basic4/basic4.qml
new file mode 100644
index 0000000..76c5723
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic4/basic4.qml
@@ -0,0 +1,33 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 200
+ height: 300
+ id: Page
+ ListModel {
+ id: Model
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ Component {
+ id: Delegate
+ Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+ ListView {
+ anchors.fill: parent
+ model: Model
+ delegate: Delegate
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png
new file mode 100644
index 0000000..f8a4830
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic4/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic4/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/ListView/basic4/test b/tests/auto/declarative/visual/ListView/basic4/test
new file mode 100644
index 0000000..2a7f227
--- /dev/null
+++ b/tests/auto/declarative/visual/ListView/basic4/test
@@ -0,0 +1 @@
+basic4.qml
diff --git a/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
new file mode 100644
index 0000000..2086648
--- /dev/null
+++ b/tests/auto/declarative/visual/bindinganimation/bindinganimation.qml
@@ -0,0 +1,40 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 320
+ height: 240
+ id: Page
+ Rect {
+ id: MyRect
+ width: 100
+ height: 100
+ color: "red"
+ x: 10
+ }
+ states: [
+ State {
+ name: "hello"
+ SetProperties {
+ target: MyRect
+ x: 100
+ }
+ SetProperties {
+ target: MyMouseRegion
+ onClicked: "Page.currentState = ''"
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ NumberAnimation {
+ properties: "x"
+ }
+ }
+ ]
+ MouseRegion {
+ id: MyMouseRegion
+ anchors.fill: parent
+ onClicked: { Page.state= 'hello' }
+ }
+}
diff --git a/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png
new file mode 100644
index 0000000..92f8cdd
--- /dev/null
+++ b/tests/auto/declarative/visual/bindinganimation/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml
new file mode 100644
index 0000000..cd096d7
--- /dev/null
+++ b/tests/auto/declarative/visual/bindinganimation/data/raster/manifest.qml
@@ -0,0 +1,88 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+ TestMouse {
+ time: 1296
+ type: 2
+ button: 1
+ buttons: 1
+ globalPos: '87,985'
+ pos: '83,29'
+ }
+ TestMouse {
+ time: 1360
+ type: 3
+ button: 1
+ buttons: 0
+ globalPos: '87,985'
+ pos: '83,29'
+ }
+ TestFrame {
+ time: 1376
+ hash: '7CB5FC371040E587DE9F06CE14A4B29A'
+ }
+ TestFrame {
+ time: 1392
+ hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE'
+ }
+ TestFrame {
+ time: 1408
+ hash: 'A5E5DBD179C7E48D34B8107F8CC6B5BE'
+ }
+ TestFrame {
+ time: 1424
+ hash: '69FB651AA84E07E4A6DEAA31CB10641B'
+ }
+ TestFrame {
+ time: 1440
+ hash: '3FFC4C4BD282010A359DCEAF2D8496AC'
+ }
+ TestFrame {
+ time: 1456
+ hash: '3FFC4C4BD282010A359DCEAF2D8496AC'
+ }
+ TestFrame {
+ time: 1472
+ hash: 'ADA58B13247A654BBCECF3F254AB797F'
+ }
+ TestFrame {
+ time: 1488
+ hash: 'B314799BC732B6BD8C42A622B720E3D5'
+ }
+ TestFrame {
+ time: 1504
+ hash: 'B314799BC732B6BD8C42A622B720E3D5'
+ }
+ TestFrame {
+ time: 1520
+ hash: '7377569C13CF5DE368B22209AB8AE395'
+ }
+ TestFrame {
+ time: 1536
+ hash: '7C1E4A1F80C68EE57D052A9D7851F937'
+ }
+ TestFrame {
+ time: 1552
+ hash: '7C1E4A1F80C68EE57D052A9D7851F937'
+ }
+ TestFrame {
+ time: 1568
+ hash: '24D6DB9544205075836A86A54B55A820'
+ }
+ TestFrame {
+ time: 1584
+ hash: '24D6DB9544205075836A86A54B55A820'
+ }
+ TestFrame {
+ time: 1600
+ hash: '8A84E4C3E8AD4C6A9A7BD3E1620718C1'
+ }
+ TestFrame {
+ time: 1616
+ hash: 'B8EA544A4EF3B7E0A9E0A7777B55EDC7'
+ }
+}
diff --git a/tests/auto/declarative/visual/bindinganimation/test b/tests/auto/declarative/visual/bindinganimation/test
new file mode 100644
index 0000000..bb59333
--- /dev/null
+++ b/tests/auto/declarative/visual/bindinganimation/test
@@ -0,0 +1 @@
+bindinganimation.qml
diff --git a/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
new file mode 100644
index 0000000..d0c988c
--- /dev/null
+++ b/tests/auto/declarative/visual/colorAnimation/colorAnimation.qml
@@ -0,0 +1,41 @@
+import Qt 4.6
+
+Rect {
+ id: mainrect
+ width: 200; height: 200
+ state: "first"
+ states: [
+ State {
+ name: "first"
+ SetProperties {
+ target: mainrect
+ color: "red"
+ }
+ },
+ State {
+ name: "second"
+ SetProperties {
+ target: mainrect
+ color: "blue"
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ fromState: "first"
+ toState: "second"
+ reversible: true
+ SequentialAnimation {
+ ColorAnimation {
+ duration: 2000
+ target: mainrect
+ property: "color"
+ }
+ }
+ }
+ ]
+ MouseRegion {
+ anchors.fill: parent
+ onClicked: { mainrect.state = 'second' }
+ }
+}
diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png
new file mode 100644
index 0000000..f00a2e2
--- /dev/null
+++ b/tests/auto/declarative/visual/colorAnimation/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml
new file mode 100644
index 0000000..0926b2c
--- /dev/null
+++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.qml
@@ -0,0 +1,524 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+ TestMouse {
+ time: 944
+ type: 2
+ button: 1
+ buttons: 1
+ globalPos: '1789,188'
+ pos: '73,76'
+ }
+ TestMouse {
+ time: 992
+ type: 3
+ button: 1
+ buttons: 0
+ globalPos: '1789,188'
+ pos: '73,76'
+ }
+ TestFrame {
+ time: 1008
+ hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0'
+ }
+ TestFrame {
+ time: 1024
+ hash: 'D35008F75B8C992F80FB16BA7203649D'
+ }
+ TestFrame {
+ time: 1040
+ hash: '14F43E0784DDF42EA8550DB88C501BF1'
+ }
+ TestFrame {
+ time: 1056
+ hash: '02276E158B5391480B1BDEAADF1FB903'
+ }
+ TestFrame {
+ time: 1072
+ hash: '35D9513EB97A2C482B7CD197DE910934'
+ }
+ TestFrame {
+ time: 1088
+ hash: 'FAF0FD681E60BB2489099F5DF772B6CD'
+ }
+ TestFrame {
+ time: 1104
+ hash: 'A863D3E346F94785A3A392FDC91526EB'
+ }
+ TestFrame {
+ time: 1120
+ hash: 'FDF328D3F6EB8410DA59A91345E41A44'
+ }
+ TestFrame {
+ time: 1136
+ hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C'
+ }
+ TestFrame {
+ time: 1152
+ hash: 'EAD0EAE76CD00189075964671EFFBAEA'
+ }
+ TestFrame {
+ time: 1168
+ hash: '24D2457FCD51490FDA23071BF9929D12'
+ }
+ TestFrame {
+ time: 1184
+ hash: '1478683446CF543DACBE31D0B76A98A6'
+ }
+ TestFrame {
+ time: 1200
+ hash: '99F7DA1F31FE920F6C02ADD4042AE925'
+ }
+ TestFrame {
+ time: 1216
+ hash: '22DEF892006CF66667770B0F17BAF6C0'
+ }
+ TestFrame {
+ time: 1232
+ hash: '6A36D5A77099BFD58BAF285478FF04E4'
+ }
+ TestFrame {
+ time: 1248
+ hash: '6258150666B59B20AB476724C07FC20C'
+ }
+ TestFrame {
+ time: 1264
+ hash: 'F1636315BC950A6DD400D9C7ED263B88'
+ }
+ TestFrame {
+ time: 1280
+ hash: '18447EA8DC2E8DA956788E5B3CF3790A'
+ }
+ TestFrame {
+ time: 1296
+ hash: '1D2A6E65997A73E9E670356C8E8B63B2'
+ }
+ TestFrame {
+ time: 1312
+ hash: 'BED0242C0F9EF229D1392835286D5782'
+ }
+ TestFrame {
+ time: 1328
+ hash: '88923C190E9E5BEADEF8A409C06DF9D6'
+ }
+ TestFrame {
+ time: 1344
+ hash: '2D133E7EE60C97386F57838B3F0976C7'
+ }
+ TestFrame {
+ time: 1360
+ hash: '85B1821CC50F2A9F3ED6944F792B7A2F'
+ }
+ TestFrame {
+ time: 1376
+ hash: '395195716D76BC0BE7B2033ED37A7A1C'
+ }
+ TestFrame {
+ time: 1392
+ hash: '243DBFFCF416926242BBCB7348974C4C'
+ }
+ TestFrame {
+ time: 1408
+ hash: 'A755068679616D8AC65C2AA7431F2A19'
+ }
+ TestFrame {
+ time: 1424
+ hash: 'E8249B35A47EB492CBDF2D91CC8426F0'
+ }
+ TestFrame {
+ time: 1440
+ hash: '15F3DA1C0E6F0779B96859D51171DD27'
+ }
+ TestFrame {
+ time: 1456
+ hash: '258C0C756AAC3DE743B43051F2AACE6B'
+ }
+ TestFrame {
+ time: 1472
+ hash: 'A58B9FDF301D72B2CC5C93934CC8927B'
+ }
+ TestFrame {
+ time: 1488
+ hash: 'A9181D30870D472521F8904818CE520F'
+ }
+ TestFrame {
+ time: 1504
+ hash: '7F9E94069CCF3897C26A71BD7BECD903'
+ }
+ TestFrame {
+ time: 1520
+ hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B'
+ }
+ TestFrame {
+ time: 1536
+ hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7'
+ }
+ TestFrame {
+ time: 1552
+ hash: '734F0DE45A6E34C9EAB7EF606196F96A'
+ }
+ TestFrame {
+ time: 1568
+ hash: '02A361C4534FDF7F286DC3E6DC23275C'
+ }
+ TestFrame {
+ time: 1584
+ hash: 'E649155AD69999C14B92F6561E4D1185'
+ }
+ TestFrame {
+ time: 1600
+ hash: '01AF177084FAB755D622973F64B92018'
+ }
+ TestFrame {
+ time: 1616
+ hash: '097CC4A082DFAB995D213A3A73883C97'
+ }
+ TestFrame {
+ time: 1632
+ hash: 'D7B4239A3280B1EB8E885E3F422DF8E9'
+ }
+ TestFrame {
+ time: 1648
+ hash: '59893977994E34E83F91E7CE3AD65D6D'
+ }
+ TestFrame {
+ time: 1664
+ hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B'
+ }
+ TestFrame {
+ time: 1680
+ hash: '94AD0580648F36A1E18A9EA7E249B04D'
+ }
+ TestFrame {
+ time: 1696
+ hash: '750A4C01D2F5806A89A1C6CC6A9B9A68'
+ }
+ TestFrame {
+ time: 1712
+ hash: '4F109F50F388F1BFA4BC6B03B3E6E514'
+ }
+ TestFrame {
+ time: 1728
+ hash: 'C6168D5CF27A533E8EE636637667BE47'
+ }
+ TestFrame {
+ time: 1744
+ hash: 'F8120547BED987AA34C00DA5A01A4D1E'
+ }
+ TestFrame {
+ time: 1760
+ hash: 'CBFF526136FA2C128C8B898FBBEF9E5C'
+ }
+ TestFrame {
+ time: 1776
+ hash: 'F29E52398FAB1A239A63DF4C32F2FC69'
+ }
+ TestFrame {
+ time: 1792
+ hash: '7178BFE86FD2FD513218B33760460F8D'
+ }
+ TestFrame {
+ time: 1808
+ hash: 'CA83285BC8AC633403896FE976896EB0'
+ }
+ TestFrame {
+ time: 1824
+ hash: '96BA486C09CC69D5AA38C46C00DF1181'
+ }
+ TestFrame {
+ time: 1840
+ hash: 'B88EAB335842787869F4A14824C19DD8'
+ }
+ TestFrame {
+ time: 1856
+ hash: '065AA59012729E1E1A246A2083142690'
+ }
+ TestFrame {
+ time: 1872
+ hash: 'DD0E98C8398861002C5F178C5F9F612D'
+ }
+ TestFrame {
+ time: 1888
+ hash: '04192C2B545948048ECCF4D81BBDE198'
+ }
+ TestFrame {
+ time: 1904
+ hash: 'BB7502C7208281EF9FD41714AB88A1A8'
+ }
+ TestFrame {
+ time: 1920
+ hash: '5397195471890D08B703DCA101E5BC7C'
+ }
+ TestFrame {
+ time: 1936
+ hash: '4C678CDBEBB2FFD2CBF012CA77800CDE'
+ }
+ TestFrame {
+ time: 1952
+ hash: '0D7A34ECD0C7F52B2C015037BF1902C6'
+ }
+ TestFrame {
+ time: 1968
+ hash: 'FD9D5048BE749AC4369FDA2D018B43AE'
+ }
+ TestFrame {
+ time: 1984
+ hash: '93EE03795CD57AE6F7FE3A020B039AD4'
+ }
+ TestFrame {
+ time: 2000
+ hash: '5E1118963F219C39761CA7FBF564A9CA'
+ }
+ TestFrame {
+ time: 2016
+ hash: '8F40038741903150136170503649D941'
+ }
+ TestFrame {
+ time: 2032
+ hash: 'B087B7D0AA6224821F8E18718FF5E77D'
+ }
+ TestFrame {
+ time: 2048
+ hash: 'AA46B04A3C67DC772265ED2901955565'
+ }
+ TestFrame {
+ time: 2064
+ hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3'
+ }
+ TestFrame {
+ time: 2080
+ hash: '13745A174E4D06E2108A5BF125BA50CC'
+ }
+ TestFrame {
+ time: 2096
+ hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08'
+ }
+ TestFrame {
+ time: 2112
+ hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA'
+ }
+ TestFrame {
+ time: 2128
+ hash: '5128584C50305C7D218B81B8367FA3D5'
+ }
+ TestFrame {
+ time: 2144
+ hash: 'A71461D3593F3685620668916DE870BD'
+ }
+ TestFrame {
+ time: 2160
+ hash: '74EBAC8F32CF044B58D9883DBCD9A722'
+ }
+ TestFrame {
+ time: 2176
+ hash: 'FEDC5B638F339B90FE59B478721E65B7'
+ }
+ TestFrame {
+ time: 2192
+ hash: 'BCB8C7159F54C353551DD3BFF3203966'
+ }
+ TestFrame {
+ time: 2208
+ hash: '4E9B083075BC5E9287A8ABC982778B56'
+ }
+ TestFrame {
+ time: 2224
+ hash: '1D6F02AA99AFA47D77FC49AB894B365A'
+ }
+ TestFrame {
+ time: 2240
+ hash: 'A204FEEC783B3B05DE4C209C21745826'
+ }
+ TestFrame {
+ time: 2256
+ hash: '665A2A8FF00B9663157802767F504754'
+ }
+ TestFrame {
+ time: 2272
+ hash: '624FB09EBE60CB87D767FAF8D2420B1E'
+ }
+ TestFrame {
+ time: 2288
+ hash: 'E5AF0CDC33F3275A25ABB09E9165F310'
+ }
+ TestFrame {
+ time: 2304
+ hash: '02BAFB5A81CA66F7670AC93DE5123860'
+ }
+ TestFrame {
+ time: 2320
+ hash: 'E7AA6374C73832E57CEB2427A1E258AA'
+ }
+ TestFrame {
+ time: 2336
+ hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0'
+ }
+ TestFrame {
+ time: 2352
+ hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7'
+ }
+ TestFrame {
+ time: 2368
+ hash: 'CE52E18C1F7732768779863B45314FF5'
+ }
+ TestFrame {
+ time: 2384
+ hash: '99D30652559DD6931E0C95543EEAA149'
+ }
+ TestFrame {
+ time: 2400
+ hash: 'FFBD9A00E05E085B89296D19D5CAEC57'
+ }
+ TestFrame {
+ time: 2416
+ hash: '9C9D658B9C25602816B8066BF19105DB'
+ }
+ TestFrame {
+ time: 2432
+ hash: '2B7FD058E6601E22A30BB7106B1C683B'
+ }
+ TestFrame {
+ time: 2448
+ hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05'
+ }
+ TestFrame {
+ time: 2464
+ hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB'
+ }
+ TestFrame {
+ time: 2480
+ hash: '9BFD7AD5091CCBDDE43C593E133A7B10'
+ }
+ TestFrame {
+ time: 2496
+ hash: '2703B617937914A90EA42EBF249D79EE'
+ }
+ TestFrame {
+ time: 2512
+ hash: 'B77E2983138254016C4CCA53100F46FA'
+ }
+ TestFrame {
+ time: 2528
+ hash: '60C4DD24187D1281081479E586F02B37'
+ }
+ TestFrame {
+ time: 2544
+ hash: '62F2511ABD99EF1231C9FA4B91D4ABFE'
+ }
+ TestFrame {
+ time: 2560
+ hash: 'E309B3353FD174E883D309571CADDC98'
+ }
+ TestFrame {
+ time: 2576
+ hash: '1E2D6A134C7B12DDE551B148EF4F088C'
+ }
+ TestFrame {
+ time: 2592
+ hash: 'E5DC5450604A491CC24A0DCF5C278B58'
+ }
+ TestFrame {
+ time: 2608
+ hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E'
+ }
+ TestFrame {
+ time: 2624
+ hash: '4E1B7E06F55FB084080689B474F1FE1D'
+ }
+ TestFrame {
+ time: 2640
+ hash: 'B4639C907FA937BF15FAC62421170CD8'
+ }
+ TestFrame {
+ time: 2656
+ hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B'
+ }
+ TestFrame {
+ time: 2672
+ hash: 'A73351EABECF0D71149EFE31F197413E'
+ }
+ TestFrame {
+ time: 2688
+ hash: '479425F1B7AFF79E4DFB7FCA534AF018'
+ }
+ TestFrame {
+ time: 2704
+ hash: '046D0F0040A52D1F26BA9F7C5DE06EF4'
+ }
+ TestFrame {
+ time: 2720
+ hash: '655778BF13C6080903150B0EB43A7EDC'
+ }
+ TestFrame {
+ time: 2736
+ hash: '72DA0BBE81514870655FDD3354ADAC60'
+ }
+ TestFrame {
+ time: 2752
+ hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7'
+ }
+ TestFrame {
+ time: 2768
+ hash: 'C988628B6C3D3780E9A865C7694926CD'
+ }
+ TestFrame {
+ time: 2784
+ hash: '5AB17563655231089EDD986FF13D6012'
+ }
+ TestFrame {
+ time: 2800
+ hash: 'C1ADFF1D2E5800ED466D1691D3B17382'
+ }
+ TestFrame {
+ time: 2816
+ hash: '70129BA01FBB19592B9DC0D0A3B3E7DF'
+ }
+ TestFrame {
+ time: 2832
+ hash: '0000829EF7ED908BF430D42904D59CC2'
+ }
+ TestFrame {
+ time: 2848
+ hash: '843D2927F50AB87B4A86B7A6AAEED91F'
+ }
+ TestFrame {
+ time: 2864
+ hash: 'DA86D21756025E7DE8050586D5E2A1F8'
+ }
+ TestFrame {
+ time: 2880
+ hash: '48DD1BD6580133B0793FEE327EA4F1E6'
+ }
+ TestFrame {
+ time: 2896
+ hash: 'F0618193DCD0BA2837249515A1898B1C'
+ }
+ TestFrame {
+ time: 2912
+ hash: 'A530184E57251065286C0CBBA7301E9C'
+ }
+ TestFrame {
+ time: 2928
+ hash: '64A1D7203973D65DD342793007A61C58'
+ }
+ TestFrame {
+ time: 2944
+ hash: '5B830DFC6BA442772DE87D75D5A578DE'
+ }
+ TestFrame {
+ time: 2960
+ hash: '5563B056B0409B65F60DD16DD0DD890E'
+ }
+ TestFrame {
+ time: 2976
+ hash: 'B8BCF9AD2CA8720C11563A23D8280804'
+ }
+ TestFrame {
+ time: 2992
+ hash: '8C0FCDA4F8956394C53FC4BA18CAA850'
+ }
+}
diff --git a/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml
new file mode 100644
index 0000000..1fe2f15
--- /dev/null
+++ b/tests/auto/declarative/visual/colorAnimation/data/raster/manifest.xml
@@ -0,0 +1,522 @@
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+ TestFrame {
+ time: 16
+ hash: 'E5BDA0DAF98288CE18DB6CE06EDA3BA0'
+ }
+ TestFrame {
+ time: 32
+ hash: 'D35008F75B8C992F80FB16BA7203649D'
+ }
+ TestFrame {
+ time: 48
+ hash: '14F43E0784DDF42EA8550DB88C501BF1'
+ }
+ TestFrame {
+ time: 64
+ hash: '02276E158B5391480B1BDEAADF1FB903'
+ }
+ TestFrame {
+ time: 80
+ hash: '35D9513EB97A2C482B7CD197DE910934'
+ }
+ TestFrame {
+ time: 96
+ hash: 'FAF0FD681E60BB2489099F5DF772B6CD'
+ }
+ TestFrame {
+ time: 112
+ hash: 'A863D3E346F94785A3A392FDC91526EB'
+ }
+ TestFrame {
+ time: 128
+ hash: 'FDF328D3F6EB8410DA59A91345E41A44'
+ }
+ TestFrame {
+ time: 144
+ hash: '83514A3B10D5BE8F6C3B128D0F3E0B1C'
+ }
+ TestFrame {
+ time: 160
+ hash: 'EAD0EAE76CD00189075964671EFFBAEA'
+ }
+ TestFrame {
+ time: 176
+ hash: '24D2457FCD51490FDA23071BF9929D12'
+ }
+ TestFrame {
+ time: 192
+ hash: '1478683446CF543DACBE31D0B76A98A6'
+ }
+ TestFrame {
+ time: 208
+ hash: '99F7DA1F31FE920F6C02ADD4042AE925'
+ }
+ TestFrame {
+ time: 224
+ hash: '22DEF892006CF66667770B0F17BAF6C0'
+ }
+ TestFrame {
+ time: 240
+ hash: '6A36D5A77099BFD58BAF285478FF04E4'
+ }
+ TestFrame {
+ time: 256
+ hash: '6258150666B59B20AB476724C07FC20C'
+ }
+ TestFrame {
+ time: 272
+ hash: 'F1636315BC950A6DD400D9C7ED263B88'
+ }
+ TestFrame {
+ time: 288
+ hash: '18447EA8DC2E8DA956788E5B3CF3790A'
+ }
+ TestFrame {
+ time: 304
+ hash: '1D2A6E65997A73E9E670356C8E8B63B2'
+ }
+ TestFrame {
+ time: 320
+ hash: 'BED0242C0F9EF229D1392835286D5782'
+ }
+ TestFrame {
+ time: 336
+ hash: '88923C190E9E5BEADEF8A409C06DF9D6'
+ }
+ TestFrame {
+ time: 352
+ hash: '2D133E7EE60C97386F57838B3F0976C7'
+ }
+ TestFrame {
+ time: 368
+ hash: '85B1821CC50F2A9F3ED6944F792B7A2F'
+ }
+ TestFrame {
+ time: 384
+ hash: '395195716D76BC0BE7B2033ED37A7A1C'
+ }
+ TestFrame {
+ time: 400
+ hash: '243DBFFCF416926242BBCB7348974C4C'
+ }
+ TestFrame {
+ time: 416
+ hash: 'A755068679616D8AC65C2AA7431F2A19'
+ }
+ TestFrame {
+ time: 432
+ hash: 'E8249B35A47EB492CBDF2D91CC8426F0'
+ }
+ TestFrame {
+ time: 448
+ hash: '15F3DA1C0E6F0779B96859D51171DD27'
+ }
+ TestFrame {
+ time: 464
+ hash: '258C0C756AAC3DE743B43051F2AACE6B'
+ }
+ TestFrame {
+ time: 480
+ hash: 'A58B9FDF301D72B2CC5C93934CC8927B'
+ }
+ TestFrame {
+ time: 496
+ hash: 'A9181D30870D472521F8904818CE520F'
+ }
+ TestFrame {
+ time: 512
+ hash: '7F9E94069CCF3897C26A71BD7BECD903'
+ }
+ TestFrame {
+ time: 528
+ hash: 'BDF305C2F46CDB86DBF57B1E0CC5A65B'
+ }
+ TestFrame {
+ time: 544
+ hash: 'FE5B6865D7E4FC7D1D42C1E74F8666F7'
+ }
+ TestFrame {
+ time: 560
+ hash: '734F0DE45A6E34C9EAB7EF606196F96A'
+ }
+ TestFrame {
+ time: 576
+ hash: '02A361C4534FDF7F286DC3E6DC23275C'
+ }
+ TestFrame {
+ time: 592
+ hash: 'E649155AD69999C14B92F6561E4D1185'
+ }
+ TestFrame {
+ time: 608
+ hash: '01AF177084FAB755D622973F64B92018'
+ }
+ TestFrame {
+ time: 624
+ hash: '097CC4A082DFAB995D213A3A73883C97'
+ }
+ TestFrame {
+ time: 640
+ hash: 'D7B4239A3280B1EB8E885E3F422DF8E9'
+ }
+ TestFrame {
+ time: 656
+ hash: '59893977994E34E83F91E7CE3AD65D6D'
+ }
+ TestFrame {
+ time: 672
+ hash: 'B68E3FBB5CDCD6BD96DF7DEC558DB42B'
+ }
+ TestFrame {
+ time: 688
+ hash: '94AD0580648F36A1E18A9EA7E249B04D'
+ }
+ TestFrame {
+ time: 704
+ hash: '750A4C01D2F5806A89A1C6CC6A9B9A68'
+ }
+ TestFrame {
+ time: 720
+ hash: '4F109F50F388F1BFA4BC6B03B3E6E514'
+ }
+ TestFrame {
+ time: 736
+ hash: 'C6168D5CF27A533E8EE636637667BE47'
+ }
+ TestFrame {
+ time: 752
+ hash: 'F8120547BED987AA34C00DA5A01A4D1E'
+ }
+ TestFrame {
+ time: 768
+ hash: 'CBFF526136FA2C128C8B898FBBEF9E5C'
+ }
+ TestFrame {
+ time: 784
+ hash: 'F29E52398FAB1A239A63DF4C32F2FC69'
+ }
+ TestFrame {
+ time: 800
+ hash: '7178BFE86FD2FD513218B33760460F8D'
+ }
+ TestFrame {
+ time: 816
+ hash: 'CA83285BC8AC633403896FE976896EB0'
+ }
+ TestFrame {
+ time: 832
+ hash: '96BA486C09CC69D5AA38C46C00DF1181'
+ }
+ TestFrame {
+ time: 848
+ hash: 'B88EAB335842787869F4A14824C19DD8'
+ }
+ TestFrame {
+ time: 864
+ hash: '065AA59012729E1E1A246A2083142690'
+ }
+ TestFrame {
+ time: 880
+ hash: 'DD0E98C8398861002C5F178C5F9F612D'
+ }
+ TestFrame {
+ time: 896
+ hash: '04192C2B545948048ECCF4D81BBDE198'
+ }
+ TestMouse {
+ time: 912
+ type: 2
+ button: 1
+ buttons: 1
+ globalPos: '1739,207'
+ pos: '75,95'
+ }
+ TestFrame {
+ time: 912
+ hash: 'BB7502C7208281EF9FD41714AB88A1A8'
+ }
+ TestFrame {
+ time: 928
+ hash: '5397195471890D08B703DCA101E5BC7C'
+ }
+ TestFrame {
+ time: 944
+ hash: '4C678CDBEBB2FFD2CBF012CA77800CDE'
+ }
+ TestFrame {
+ time: 960
+ hash: '0D7A34ECD0C7F52B2C015037BF1902C6'
+ }
+ TestMouse {
+ time: 976
+ type: 3
+ button: 1
+ buttons: 0
+ globalPos: '1739,207'
+ pos: '75,95'
+ }
+ TestFrame {
+ time: 976
+ hash: 'FD9D5048BE749AC4369FDA2D018B43AE'
+ }
+ TestFrame {
+ time: 992
+ hash: '93EE03795CD57AE6F7FE3A020B039AD4'
+ }
+ TestFrame {
+ time: 1008
+ hash: '5E1118963F219C39761CA7FBF564A9CA'
+ }
+ TestFrame {
+ time: 1024
+ hash: '8F40038741903150136170503649D941'
+ }
+ TestFrame {
+ time: 1040
+ hash: 'B087B7D0AA6224821F8E18718FF5E77D'
+ }
+ TestFrame {
+ time: 1056
+ hash: 'AA46B04A3C67DC772265ED2901955565'
+ }
+ TestFrame {
+ time: 1072
+ hash: 'AC024BF2AEB4BECDF31A09FE0A6DB8F3'
+ }
+ TestFrame {
+ time: 1088
+ hash: '13745A174E4D06E2108A5BF125BA50CC'
+ }
+ TestFrame {
+ time: 1104
+ hash: 'BD972F0D8E230ECA0B3FEA1B8C960C08'
+ }
+ TestFrame {
+ time: 1120
+ hash: 'CBDBEC802A58E7CED0CF45B3AB0BC0BA'
+ }
+ TestFrame {
+ time: 1136
+ hash: '5128584C50305C7D218B81B8367FA3D5'
+ }
+ TestFrame {
+ time: 1152
+ hash: 'A71461D3593F3685620668916DE870BD'
+ }
+ TestFrame {
+ time: 1168
+ hash: '74EBAC8F32CF044B58D9883DBCD9A722'
+ }
+ TestFrame {
+ time: 1184
+ hash: 'FEDC5B638F339B90FE59B478721E65B7'
+ }
+ TestFrame {
+ time: 1200
+ hash: 'BCB8C7159F54C353551DD3BFF3203966'
+ }
+ TestFrame {
+ time: 1216
+ hash: '4E9B083075BC5E9287A8ABC982778B56'
+ }
+ TestFrame {
+ time: 1232
+ hash: '1D6F02AA99AFA47D77FC49AB894B365A'
+ }
+ TestFrame {
+ time: 1248
+ hash: 'A204FEEC783B3B05DE4C209C21745826'
+ }
+ TestFrame {
+ time: 1264
+ hash: '665A2A8FF00B9663157802767F504754'
+ }
+ TestFrame {
+ time: 1280
+ hash: '624FB09EBE60CB87D767FAF8D2420B1E'
+ }
+ TestFrame {
+ time: 1296
+ hash: 'E5AF0CDC33F3275A25ABB09E9165F310'
+ }
+ TestFrame {
+ time: 1312
+ hash: '02BAFB5A81CA66F7670AC93DE5123860'
+ }
+ TestFrame {
+ time: 1328
+ hash: 'E7AA6374C73832E57CEB2427A1E258AA'
+ }
+ TestFrame {
+ time: 1344
+ hash: 'B5ABD0DFF1AB076FAAC7CC226E83F5D0'
+ }
+ TestFrame {
+ time: 1360
+ hash: 'B759ACC35BCCFF8EFC2E6FE276DDC0F7'
+ }
+ TestFrame {
+ time: 1376
+ hash: 'CE52E18C1F7732768779863B45314FF5'
+ }
+ TestFrame {
+ time: 1392
+ hash: '99D30652559DD6931E0C95543EEAA149'
+ }
+ TestFrame {
+ time: 1408
+ hash: 'FFBD9A00E05E085B89296D19D5CAEC57'
+ }
+ TestFrame {
+ time: 1424
+ hash: '9C9D658B9C25602816B8066BF19105DB'
+ }
+ TestFrame {
+ time: 1440
+ hash: '2B7FD058E6601E22A30BB7106B1C683B'
+ }
+ TestFrame {
+ time: 1456
+ hash: 'F4C7E26B19EE0A3E7C9688685EB7BD05'
+ }
+ TestFrame {
+ time: 1472
+ hash: '0DC6D593BCEFF56B7F81F2A49D37FEFB'
+ }
+ TestFrame {
+ time: 1488
+ hash: '9BFD7AD5091CCBDDE43C593E133A7B10'
+ }
+ TestFrame {
+ time: 1504
+ hash: '2703B617937914A90EA42EBF249D79EE'
+ }
+ TestFrame {
+ time: 1520
+ hash: 'B77E2983138254016C4CCA53100F46FA'
+ }
+ TestFrame {
+ time: 1536
+ hash: '60C4DD24187D1281081479E586F02B37'
+ }
+ TestFrame {
+ time: 1552
+ hash: '62F2511ABD99EF1231C9FA4B91D4ABFE'
+ }
+ TestFrame {
+ time: 1568
+ hash: 'E309B3353FD174E883D309571CADDC98'
+ }
+ TestFrame {
+ time: 1584
+ hash: '1E2D6A134C7B12DDE551B148EF4F088C'
+ }
+ TestFrame {
+ time: 1600
+ hash: 'E5DC5450604A491CC24A0DCF5C278B58'
+ }
+ TestFrame {
+ time: 1616
+ hash: 'C8DAE97C10E1962C1E6A51AB3AB8579E'
+ }
+ TestFrame {
+ time: 1632
+ hash: '4E1B7E06F55FB084080689B474F1FE1D'
+ }
+ TestFrame {
+ time: 1648
+ hash: 'B4639C907FA937BF15FAC62421170CD8'
+ }
+ TestFrame {
+ time: 1664
+ hash: 'C250208A0CAEB5F6CB4D3AAC3D7D350B'
+ }
+ TestFrame {
+ time: 1680
+ hash: 'A73351EABECF0D71149EFE31F197413E'
+ }
+ TestFrame {
+ time: 1696
+ hash: '479425F1B7AFF79E4DFB7FCA534AF018'
+ }
+ TestFrame {
+ time: 1712
+ hash: '046D0F0040A52D1F26BA9F7C5DE06EF4'
+ }
+ TestFrame {
+ time: 1728
+ hash: '655778BF13C6080903150B0EB43A7EDC'
+ }
+ TestFrame {
+ time: 1744
+ hash: '72DA0BBE81514870655FDD3354ADAC60'
+ }
+ TestFrame {
+ time: 1760
+ hash: 'DEFE0BDF675C65FFF55AAACED1E4DAE7'
+ }
+ TestFrame {
+ time: 1776
+ hash: 'C988628B6C3D3780E9A865C7694926CD'
+ }
+ TestFrame {
+ time: 1792
+ hash: '5AB17563655231089EDD986FF13D6012'
+ }
+ TestFrame {
+ time: 1808
+ hash: 'C1ADFF1D2E5800ED466D1691D3B17382'
+ }
+ TestFrame {
+ time: 1824
+ hash: '70129BA01FBB19592B9DC0D0A3B3E7DF'
+ }
+ TestFrame {
+ time: 1840
+ hash: '0000829EF7ED908BF430D42904D59CC2'
+ }
+ TestFrame {
+ time: 1856
+ hash: '843D2927F50AB87B4A86B7A6AAEED91F'
+ }
+ TestFrame {
+ time: 1872
+ hash: 'DA86D21756025E7DE8050586D5E2A1F8'
+ }
+ TestFrame {
+ time: 1888
+ hash: '48DD1BD6580133B0793FEE327EA4F1E6'
+ }
+ TestFrame {
+ time: 1904
+ hash: 'F0618193DCD0BA2837249515A1898B1C'
+ }
+ TestFrame {
+ time: 1920
+ hash: 'A530184E57251065286C0CBBA7301E9C'
+ }
+ TestFrame {
+ time: 1936
+ hash: '64A1D7203973D65DD342793007A61C58'
+ }
+ TestFrame {
+ time: 1952
+ hash: '5B830DFC6BA442772DE87D75D5A578DE'
+ }
+ TestFrame {
+ time: 1968
+ hash: '5563B056B0409B65F60DD16DD0DD890E'
+ }
+ TestFrame {
+ time: 1984
+ hash: 'B8BCF9AD2CA8720C11563A23D8280804'
+ }
+ TestFrame {
+ time: 2000
+ hash: '8C0FCDA4F8956394C53FC4BA18CAA850'
+ }
+}
diff --git a/tests/auto/declarative/visual/colorAnimation/manifest-play.xml b/tests/auto/declarative/visual/colorAnimation/manifest-play.xml
new file mode 100644
index 0000000..8e3de2e
--- /dev/null
+++ b/tests/auto/declarative/visual/colorAnimation/manifest-play.xml
@@ -0,0 +1,73 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLog>
+ <TestFullFrame time="30" frameId="0"/>
+ <TestMouse time="480" type="2" button="1" buttons="1" globalPos="93,129" pos="89,102"/>
+ <TestMouse time="570" type="3" button="1" buttons="0" globalPos="93,129" pos="89,102"/>
+ <TestFrame time="630" hash="D42762ECD293C6922C5F9593126DE636"/>
+ <TestFrame time="660" hash="8962505FCCB2E7559A99A8EDD325A82B"/>
+ <TestFrame time="690" hash="6812EFDA80607D4FA05CD3A5077F8EF7"/>
+ <TestFrame time="720" hash="A116DF73809679C1C5F9261F49B989F0"/>
+ <TestFrame time="750" hash="DC1B9D40AEE306171AD6625DDCA4EB45"/>
+ <TestFrame time="780" hash="B2DAF0E4C32080229664A8B0A155DE3B"/>
+ <TestFrame time="810" hash="496677B0D8707B91566D1244C46D50DB"/>
+ <TestFrame time="840" hash="A6558D8B0D1FB1D11BEBE36C078386CE"/>
+ <TestFrame time="870" hash="601436BB436D391B0BD5FCC289666208"/>
+ <TestFrame time="900" hash="8CF3CF9EAD875497870CC7C1035802DC"/>
+ <TestFrame time="930" hash="FF6BA6BAC30DADD3DBBFD96F127EB1FE"/>
+ <TestFrame time="960" hash="1D97A2A6890078DCF4CE9E508E5F9F08"/>
+ <TestFrame time="990" hash="58C9116FDDD03DD036820EFCD0DCD392"/>
+ <TestFrame time="1020" hash="E51287B911C140B41D350FCB2091AB80"/>
+ <TestFrame time="1050" hash="7B107411B436FABE469A069E6E5B0C3C"/>
+ <TestFrame time="1080" hash="9D1CB0E58F2BD00DDA0FB463F6BFF526"/>
+ <TestFrame time="1110" hash="35AB7788489B79E5A5C6F2BE11AFC9E1"/>
+ <TestFrame time="1140" hash="C82177AC4A7A497469292C5F0F8C4913"/>
+ <TestFrame time="1170" hash="18763D1B911FDC524DB9E7B2569FE984"/>
+ <TestFrame time="1200" hash="27F63572AAEF6D835272D5D65FCF608B"/>
+ <TestFrame time="1230" hash="585727CAEC1F83ADB9E422BAF058A622"/>
+ <TestFrame time="1260" hash="2C3BBFEFBE6E5FDA1905E9F50985E1B4"/>
+ <TestFrame time="1290" hash="81675C4ABB2696D960BC5F204F05F16B"/>
+ <TestFrame time="1320" hash="6D0F3CCC06EF1E3A895ECC9A8DE90039"/>
+ <TestFrame time="1350" hash="0BF36093CCAEA8BDAE96D4939A8DDE20"/>
+ <TestFrame time="1380" hash="5A1CBC68AB59977B65492B0F8A664418"/>
+ <TestFrame time="1410" hash="C35831A8C59D56193CED2C4AADB4DFCE"/>
+ <TestFrame time="1440" hash="ED15973425A8B8528896B344A61393AA"/>
+ <TestFrame time="1470" hash="EA8FC02A8606680C089F0C0CE454ABE3"/>
+ <TestFrame time="1500" hash="CFB5CFBA0A0BC62C0D03908FB9599A8E"/>
+ <TestFrame time="1530" hash="09FAA04AFB50B48BD6A83F9E25F9DDDB"/>
+ <TestFrame time="1560" hash="0FDD0B8CDCCEB78C7C67AB0F5EA74D6A"/>
+ <TestFrame time="1590" hash="058D26146879900B5E5CCE05AE38BA0E"/>
+ <TestFrame time="1620" hash="80F9074C50F967C99D4C3A3FF9EC3E71"/>
+ <TestFrame time="1650" hash="AD9BDCEEC1C058D6B658C5BA0D0BC1F0"/>
+ <TestFrame time="1680" hash="AC14DF5458F91001181154F8C68BCE2B"/>
+ <TestFrame time="1710" hash="AE9225263E4C8E75E4D0F1D7192B4260"/>
+ <TestFrame time="1740" hash="D3D50F1B7F476E79E5B99E0E6D4CF827"/>
+ <TestFrame time="1770" hash="A1367445C5232ACCBF4904A415416EA4"/>
+ <TestFrame time="1800" hash="A21C0F1DA9B64A5B000558BA1F2E495D"/>
+ <TestFrame time="1830" hash="61AF477B6FB22E38E698375EA5793D22"/>
+ <TestFrame time="1860" hash="B3AD3501D527939CEAA4F124AB10B2DF"/>
+ <TestFrame time="1890" hash="0C2BF65A43AE87AFB0068F9FA4A74707"/>
+ <TestFrame time="1920" hash="5B7F96C797BEE4FD1B04538DE5549C1B"/>
+ <TestFrame time="1950" hash="4C861E936A3F1AFE323395E30174F8CC"/>
+ <TestFrame time="1980" hash="87F1966E5B0E924EB7CEED5520D120BF"/>
+ <TestFrame time="2010" hash="1980755E0D80469D4DC0B9B0309F2DEB"/>
+ <TestFrame time="2040" hash="38A7ACC2E5607FC0965B7B376A0D3524"/>
+ <TestFrame time="2070" hash="4434746833EFF5A3A76491024763990A"/>
+ <TestFrame time="2100" hash="A8BAD928F92E851B45723068B7FEF739"/>
+ <TestFrame time="2130" hash="A96F5C522C0ECA5C78E982E4235218CB"/>
+ <TestFrame time="2160" hash="135F0EFEDE2832B76F49966EBD629879"/>
+ <TestFrame time="2190" hash="A51C6E443413F184CAAE8A7F98A369C8"/>
+ <TestFrame time="2220" hash="62A7521EE62E6A2543B3141C1EFCE72A"/>
+ <TestFrame time="2250" hash="D416A41125659167B3E6AD68F66F6E64"/>
+ <TestFrame time="2280" hash="0F653B5E965665A43F50437724DC704C"/>
+ <TestFrame time="2310" hash="13A6E2485179501FF3AA8BA91A5050B4"/>
+ <TestFrame time="2340" hash="9423475D3832FBABEC56B80FA9161020"/>
+ <TestFrame time="2370" hash="497B21108A6CB127DB066B32D06D992A"/>
+ <TestFrame time="2400" hash="22F01CB9B4F8FF01410566A61E281373"/>
+ <TestFrame time="2430" hash="A099640BC088E14E20585CB87FC5C6F1"/>
+ <TestFrame time="2460" hash="AC2954553C333EA1D524CE51CD35958A"/>
+ <TestFrame time="2490" hash="771E882CC788BECAA82E71E6FBAB150D"/>
+ <TestFrame time="2520" hash="42CEDA45D88A8D2B3DA5B749F4C3C1BF"/>
+ <TestFrame time="2550" hash="C6E1F91B917E47246E012D1B203E0DC2"/>
+ <TestFrame time="2580" hash="EFB3E57CF265B6E36AA4DF72771D119C"/>
+ <TestFrame time="2610" hash="657FC7FD496E5A2FC84F63930E0D1DE3"/>
+</TestLog>
diff --git a/tests/auto/declarative/visual/easing/easing.qml b/tests/auto/declarative/visual/easing/easing.qml
new file mode 100644
index 0000000..7bd6c8f
--- /dev/null
+++ b/tests/auto/declarative/visual/easing/easing.qml
@@ -0,0 +1,186 @@
+import Qt 4.6
+
+Rect {
+ id: item
+ width: 600
+ height: layout.height
+ color: "white"
+ resources: [
+ ListModel {
+ id: easingtypes
+ ListElement {
+ type: "easeNone"
+ }
+ ListElement {
+ type: "easeInQuad"
+ }
+ ListElement {
+ type: "easeOutQuad"
+ }
+ ListElement {
+ type: "easeInOutQuad"
+ }
+ ListElement {
+ type: "easeOutInQuad"
+ }
+ ListElement {
+ type: "easeInCubic"
+ }
+ ListElement {
+ type: "easeOutCubic"
+ }
+ ListElement {
+ type: "easeInOutCubic"
+ }
+ ListElement {
+ type: "easeOutInCubic"
+ }
+ ListElement {
+ type: "easeInQuart"
+ }
+ ListElement {
+ type: "easeOutQuart"
+ }
+ ListElement {
+ type: "easeInOutQuart"
+ }
+ ListElement {
+ type: "easeOutInQuart"
+ }
+ ListElement {
+ type: "easeInQuint"
+ }
+ ListElement {
+ type: "easeOutQuint"
+ }
+ ListElement {
+ type: "easeInOutQuint"
+ }
+ ListElement {
+ type: "easeOutInQuint"
+ }
+ ListElement {
+ type: "easeInSine"
+ }
+ ListElement {
+ type: "easeOutSine"
+ }
+ ListElement {
+ type: "easeInOutSine"
+ }
+ ListElement {
+ type: "easeOutInSine"
+ }
+ ListElement {
+ type: "easeInExpo"
+ }
+ ListElement {
+ type: "easeOutExpo"
+ }
+ ListElement {
+ type: "easeInOutExpo"
+ }
+ ListElement {
+ type: "easeOutInExpo"
+ }
+ ListElement {
+ type: "easeInCirc"
+ }
+ ListElement {
+ type: "easeOutCirc"
+ }
+ ListElement {
+ type: "easeInOutCirc"
+ }
+ ListElement {
+ type: "easeOutInCirc"
+ }
+ ListElement {
+ type: "easeInElastic"
+ }
+ ListElement {
+ type: "easeOutElastic"
+ }
+ ListElement {
+ type: "easeInOutElastic"
+ }
+ ListElement {
+ type: "easeOutInElastic"
+ }
+ ListElement {
+ type: "easeInBack"
+ }
+ ListElement {
+ type: "easeOutBack"
+ }
+ ListElement {
+ type: "easeInOutBack"
+ }
+ ListElement {
+ type: "easeOutInBack"
+ }
+ ListElement {
+ type: "easeOutBounce"
+ }
+ ListElement {
+ type: "easeInBounce"
+ }
+ ListElement {
+ type: "easeInOutBounce"
+ }
+ ListElement {
+ type: "easeOutInBounce"
+ }
+ }
+ ]
+ VerticalLayout {
+ id: layout
+ anchors.left: item.left
+ anchors.right: item.right
+ Repeater {
+ dataSource: easingtypes
+ Component {
+ Text {
+ id: text
+ text: type
+ height: 18
+ font.italic: true
+ color: "black"
+ states: [
+ State {
+ name: "from"
+ when: !mouse.pressed
+ SetProperties {
+ target: text
+ x: 0
+ }
+ },
+ State {
+ name: "to"
+ when: mouse.pressed
+ SetProperties {
+ target: text
+ x: item.width-100
+ }
+ }
+ ]
+ transitions: [
+ Transition {
+ fromState: "*"
+ toState: "to"
+ reversible: true
+ NumberAnimation {
+ properties: "x"
+ easing: type
+ }
+ }
+ ]
+ }
+ }
+ }
+ }
+ MouseRegion {
+ id: mouse
+ anchors.fill: layout
+ }
+}
diff --git a/tests/auto/declarative/visual/easing/image0.png b/tests/auto/declarative/visual/easing/image0.png
new file mode 100644
index 0000000..dbe03aa
--- /dev/null
+++ b/tests/auto/declarative/visual/easing/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/easing/manifest-play.xml b/tests/auto/declarative/visual/easing/manifest-play.xml
new file mode 100644
index 0000000..3c84452
--- /dev/null
+++ b/tests/auto/declarative/visual/easing/manifest-play.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLog>
+ <TestFullFrame time="30" frameId="0"/>
+ <TestMouse time="480" type="2" button="1" buttons="1" globalPos="487,444" pos="483,417"/>
+ <TestFrame time="510" hash="83FB660D6CABAAFCB27C6EC001B14110"/>
+ <TestFrame time="540" hash="27FCD68F610024000CA6D3A8D9F0CF09"/>
+ <TestFrame time="570" hash="14728A6160AF51FCA8562D6A020BBA79"/>
+ <TestFrame time="600" hash="BDDB81682B30A6918927ACB59608D14E"/>
+ <TestFrame time="630" hash="03F16A41DCD31E41935E54763757C6D5"/>
+ <TestFrame time="660" hash="2D04EA1EBEDC77CF5D42A1B491A57EA6"/>
+ <TestFrame time="690" hash="762C36B33B75F24427CA45F4AD06B64E"/>
+ <TestFrame time="720" hash="AA02624CC889C95A99BBE58365F4FAAD"/>
+ <TestFrame time="750" hash="0529200188188708A18CE0F931780DBD"/>
+ <TestFrame time="780" hash="56036B63822AF34F26B149069CD189C6"/>
+ <TestFrame time="810" hash="CFFC6583E2BA1E47E1439BED6FE69665"/>
+ <TestFrame time="840" hash="25A1AFDC945D5264FF0337A421143A3C"/>
+ <TestFrame time="870" hash="601FA34B5E15E7B87E6490580C2E1858"/>
+ <TestFrame time="900" hash="1CA085F6CB8509957A51F6182F7F5443"/>
+ <TestFrame time="930" hash="09B5849DF18F6817F7450230DFEC0E95"/>
+ <TestFrame time="960" hash="15D212C1291DF97E3DEA5AA8793AD5CB"/>
+ <TestFrame time="990" hash="D6E42E8F4D06BDDBAE998079AC2C79AD"/>
+ <TestFrame time="1020" hash="7016B5C435006D859AB087A73299B6D5"/>
+</TestLog>
diff --git a/tests/auto/declarative/visual/easing/manifest.xml b/tests/auto/declarative/visual/easing/manifest.xml
new file mode 100644
index 0000000..3c84452
--- /dev/null
+++ b/tests/auto/declarative/visual/easing/manifest.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLog>
+ <TestFullFrame time="30" frameId="0"/>
+ <TestMouse time="480" type="2" button="1" buttons="1" globalPos="487,444" pos="483,417"/>
+ <TestFrame time="510" hash="83FB660D6CABAAFCB27C6EC001B14110"/>
+ <TestFrame time="540" hash="27FCD68F610024000CA6D3A8D9F0CF09"/>
+ <TestFrame time="570" hash="14728A6160AF51FCA8562D6A020BBA79"/>
+ <TestFrame time="600" hash="BDDB81682B30A6918927ACB59608D14E"/>
+ <TestFrame time="630" hash="03F16A41DCD31E41935E54763757C6D5"/>
+ <TestFrame time="660" hash="2D04EA1EBEDC77CF5D42A1B491A57EA6"/>
+ <TestFrame time="690" hash="762C36B33B75F24427CA45F4AD06B64E"/>
+ <TestFrame time="720" hash="AA02624CC889C95A99BBE58365F4FAAD"/>
+ <TestFrame time="750" hash="0529200188188708A18CE0F931780DBD"/>
+ <TestFrame time="780" hash="56036B63822AF34F26B149069CD189C6"/>
+ <TestFrame time="810" hash="CFFC6583E2BA1E47E1439BED6FE69665"/>
+ <TestFrame time="840" hash="25A1AFDC945D5264FF0337A421143A3C"/>
+ <TestFrame time="870" hash="601FA34B5E15E7B87E6490580C2E1858"/>
+ <TestFrame time="900" hash="1CA085F6CB8509957A51F6182F7F5443"/>
+ <TestFrame time="930" hash="09B5849DF18F6817F7450230DFEC0E95"/>
+ <TestFrame time="960" hash="15D212C1291DF97E3DEA5AA8793AD5CB"/>
+ <TestFrame time="990" hash="D6E42E8F4D06BDDBAE998079AC2C79AD"/>
+ <TestFrame time="1020" hash="7016B5C435006D859AB087A73299B6D5"/>
+</TestLog>
diff --git a/tests/auto/declarative/visual/easing/pics/qtlogo.png b/tests/auto/declarative/visual/easing/pics/qtlogo.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/visual/easing/pics/qtlogo.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flickable/Day.qml b/tests/auto/declarative/visual/flickable/Day.qml
new file mode 100644
index 0000000..549a9a0
--- /dev/null
+++ b/tests/auto/declarative/visual/flickable/Day.qml
@@ -0,0 +1,27 @@
+import Qt 4.6
+
+Rect {
+ property string day
+
+ width: 200
+ height: 300
+ radius: 7
+ pen.color: "black"
+ id: Page
+ Image {
+ x: 10
+ y: 10
+ source: "cork.jpg"
+ opaque: true
+ }
+ Text {
+ x: 20
+ y: 20
+ height: 40
+ font.size: 14
+ font.bold: true
+ text: day
+ style: "Outline"
+ styleColor: "#dedede"
+ }
+}
diff --git a/tests/auto/declarative/visual/flickable/cork.jpg b/tests/auto/declarative/visual/flickable/cork.jpg
new file mode 100644
index 0000000..6dc3a3f
--- /dev/null
+++ b/tests/auto/declarative/visual/flickable/cork.jpg
Binary files differ
diff --git a/tests/auto/declarative/visual/flickable/flickable.qml b/tests/auto/declarative/visual/flickable/flickable.qml
new file mode 100644
index 0000000..24931de
--- /dev/null
+++ b/tests/auto/declarative/visual/flickable/flickable.qml
@@ -0,0 +1,55 @@
+import Qt 4.6
+
+Rect {
+ color: "lightSteelBlue"
+ width: 600
+ height: 300
+ ListModel {
+ id: List
+ ListElement {
+ name: "Sunday"
+ dayColor: "#808080"
+ }
+ ListElement {
+ name: "Monday"
+ dayColor: "blue"
+ }
+ ListElement {
+ name: "Tuesday"
+ dayColor: "yellow"
+ }
+ ListElement {
+ name: "Wednesday"
+ dayColor: "purple"
+ }
+ ListElement {
+ name: "Thursday"
+ dayColor: "blue"
+ }
+ ListElement {
+ name: "Friday"
+ dayColor: "green"
+ }
+ ListElement {
+ name: "Saturday"
+ dayColor: "orange"
+ }
+ }
+ Flickable {
+ id: Flick
+ anchors.fill: parent
+ viewportWidth: Lay.width
+ HorizontalLayout {
+ id: Lay
+ Repeater {
+ dataSource: List
+ Component {
+ Day {
+ day: name
+ color: dayColor
+ }
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/flipable/flipable.xml b/tests/auto/declarative/visual/flipable/flipable.xml
new file mode 100644
index 0000000..9288acc
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/flipable.xml
@@ -0,0 +1,138 @@
+<Rect color="lightsteelblue" height="400" width="500">
+ <VisualModel id="MyVisualModel">
+ <model>
+ <ListModel id="ListModel">
+ <Person>
+ <name>Jessica</name>
+ <picture>face.png</picture>
+ </Person>
+ <Person>
+ <name>John</name>
+ <picture>photo0.png</picture>
+ </Person>
+ <Person>
+ <name>Susan</name>
+ <picture>photo10.png</picture>
+ </Person>
+ <Person>
+ <name>Samantha</name>
+ <picture>photo1.png</picture>
+ </Person>
+ <Person>
+ <name>Mark</name>
+ <picture>photo2.png</picture>
+ </Person>
+ <Person>
+ <name>Sarah</name>
+ <picture>photo3.png</picture>
+ </Person>
+ <Person>
+ <name>Pam</name>
+ <picture>photo4.png</picture>
+ </Person>
+ <Person>
+ <name>April</name>
+ <picture>photo5.png</picture>
+ </Person>
+ <Person>
+ <name>Tarryn</name>
+ <picture>photo6.png</picture>
+ </Person>
+ <Person>
+ <name>Geoff</name>
+ <picture>photo7.png</picture>
+ </Person>
+ <Person>
+ <name>Bill</name>
+ <picture>photo8.png</picture>
+ </Person>
+ <Person>
+ <name>Stuart</name>
+ <picture>photo9.png</picture>
+ </Person>
+ </ListModel>
+ </model>
+ <delegate>
+ <Package>
+ <Flipable id="MeRect" width="100" height="100">
+ <properties>
+ <Property name="r" type="Real" />
+ </properties>
+ <transform>
+ <Perspective angle="90" x="50" y="50" aspect="1" scale="256"/>
+ <Axis xStart="50" xEnd="50" yStart="0" yEnd="1" rotation="{MeRect.r}" />
+ </transform>
+
+ <front>
+ <Rect radius="5" color="red" width="100" height="100">
+ <Text text="{name}" />
+ </Rect>
+ </front>
+
+ <back>
+ <Rect radius="5" color="red" width="100" height="100">
+ <Image anchors.horizontalCenter="{parent.horizontalCenter}" anchors.verticalCenter="{parent.verticalCenter}" file="{picture}" />
+ </Rect>
+ </back>
+ </Flipable>
+
+ <Item Package.name="leftBox" id="LeftBox"
+ width="100" height="100">
+ <Rect opacity="0.1" width="80" height="80" radius="4"
+ color="grey" x="10" y="10">
+ <Text text="{name}" />
+ <MouseRegion anchors.fill="{parent}" onClick="if(MyItem.currentState=='left') MyItem.currentState='right'; else MyItem.currentState='left';" />
+ </Rect>
+ </Item>
+ <Item Package.name="rightBox" id="RightBox"
+ width="100" height="100">
+ <Rect opacity="0.1" width="80" height="80" radius="4"
+ color="grey" x="10" y="10">
+ <Text text="{name}" />
+ <MouseRegion anchors.fill="{parent}" onClick="if(MyItem.currentState=='left') MyItem.currentState='right'; else MyItem.currentState='left';" />
+ </Rect>
+ </Item>
+ <Item id="MyItem">
+ <states>
+ <State name="left">
+ <SetProperty target="{MeRect}" property="moveToParent" value="{LeftBox}" />
+ </State>
+ <State name="right">
+ <SetProperty target="{MeRect}" property="moveToParent" value="{RightBox}" />
+ <SetProperty target="{MeRect}" property="r" value="180" />
+ </State>
+ </states>
+ <transitions>
+ <Transition fromState="*" toState="*">
+ <NumberAnimation property="r" duration="500" />
+ <SerialAnimation>
+ <SetPropertyAction target="{MeRect}" property="moveToParent" value="{Bounce}" />
+ <ParallelAnimation>
+ <NumberAnimation target="{MeRect}" properties="x" to="0" duration="250" />
+ <NumberAnimation target="{MeRect}" properties="y" to="0" easing="easeInQuad" duration="250"/>
+ </ParallelAnimation>
+ <SetPropertyAction target="{MeRect}" property="moveToParent" />
+ <ParallelAnimation>
+ <NumberAnimation target="{MeRect}" properties="x" to="0" duration="250"/>
+ <NumberAnimation target="{MeRect}" properties="y" to="0" easing="easeOutQuad" duration="250"/>
+ </ParallelAnimation>
+ </SerialAnimation>
+ </Transition>
+ </transitions>
+ <currentState>left</currentState>
+ </Item>
+
+ </Package>
+ </delegate>
+ </VisualModel>
+
+ <Item width="800" height="400" clip="true">
+ <Item z="100" id="Bounce" x="200" y="300" />
+ <ListView id="MyListView" width="400" height="400" x="400"
+ model="{MyVisualModel.parts.rightBox}" />
+
+ <ListView id="MyListView2" width="400" height="400"
+ model="{MyVisualModel.parts.leftBox}" />
+ </Item>
+
+</Rect>
diff --git a/tests/auto/declarative/visual/flipable/image0.png b/tests/auto/declarative/visual/flipable/image0.png
new file mode 100644
index 0000000..affb8a5
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/manifest-play.xml b/tests/auto/declarative/visual/flipable/manifest-play.xml
new file mode 100644
index 0000000..81c08e4
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/manifest-play.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLog>
+ <TestFullFrame time="30" frameId="0"/>
+ <TestMouse time="2040" type="2" button="1" buttons="1" globalPos="812,72" pos="65,45"/>
+ <TestMouse time="2100" type="3" button="1" buttons="0" globalPos="812,72" pos="65,45"/>
+ <TestFrame time="2130" hash="210454ECF70EEA9CA43DD391BC23178B"/>
+ <TestFrame time="2160" hash="F6612DAD879208F4AF100337271C445C"/>
+ <TestFrame time="2190" hash="C77FC41100D0B066F8F0BF4ABCF2F0BF"/>
+ <TestFrame time="2220" hash="1AB3A42E6FC271E049E6071A88AB8EE4"/>
+ <TestFrame time="2250" hash="DB3D5BC6882699DCC0208E4F5294B609"/>
+ <TestFrame time="2280" hash="DC5A8B44283DA4A81D3994B873FC5695"/>
+ <TestFrame time="2310" hash="5149027ECF7813BA64D3AB8FFE0265F5"/>
+ <TestFrame time="2340" hash="B7E801DF476C012AC3E9E48A9D4AA321"/>
+ <TestFrame time="2370" hash="F31A647A6A3EC86D7F16EB3147E5FC29"/>
+ <TestFrame time="2400" hash="FBB068C39D5188A175075667B584F1BE"/>
+ <TestFrame time="2430" hash="EC487AB66384A4A3A718D03555EBFD41"/>
+ <TestFrame time="2460" hash="C7AD11EB051B11ACBA38027013215A05"/>
+ <TestFrame time="2490" hash="AA38FD8E97EC394488274127630E7946"/>
+ <TestFrame time="2520" hash="1CA2B617AC966B54FFA1A61914F68A9D"/>
+ <TestFrame time="2550" hash="1726C0BAA930CAF282154F14AC2FD120"/>
+ <TestFrame time="2580" hash="58F8196148C8B64191AF7B897A811CFB"/>
+ <TestFrame time="2610" hash="D56D3FA137AA63A0215611450B40F3E0"/>
+ <TestFrame time="2640" hash="5E1BCDF996B2903D1EAEAC65E17783C2"/>
+</TestLog>
diff --git a/tests/auto/declarative/visual/flipable/manifest.xml b/tests/auto/declarative/visual/flipable/manifest.xml
new file mode 100644
index 0000000..81c08e4
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/manifest.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<TestLog>
+ <TestFullFrame time="30" frameId="0"/>
+ <TestMouse time="2040" type="2" button="1" buttons="1" globalPos="812,72" pos="65,45"/>
+ <TestMouse time="2100" type="3" button="1" buttons="0" globalPos="812,72" pos="65,45"/>
+ <TestFrame time="2130" hash="210454ECF70EEA9CA43DD391BC23178B"/>
+ <TestFrame time="2160" hash="F6612DAD879208F4AF100337271C445C"/>
+ <TestFrame time="2190" hash="C77FC41100D0B066F8F0BF4ABCF2F0BF"/>
+ <TestFrame time="2220" hash="1AB3A42E6FC271E049E6071A88AB8EE4"/>
+ <TestFrame time="2250" hash="DB3D5BC6882699DCC0208E4F5294B609"/>
+ <TestFrame time="2280" hash="DC5A8B44283DA4A81D3994B873FC5695"/>
+ <TestFrame time="2310" hash="5149027ECF7813BA64D3AB8FFE0265F5"/>
+ <TestFrame time="2340" hash="B7E801DF476C012AC3E9E48A9D4AA321"/>
+ <TestFrame time="2370" hash="F31A647A6A3EC86D7F16EB3147E5FC29"/>
+ <TestFrame time="2400" hash="FBB068C39D5188A175075667B584F1BE"/>
+ <TestFrame time="2430" hash="EC487AB66384A4A3A718D03555EBFD41"/>
+ <TestFrame time="2460" hash="C7AD11EB051B11ACBA38027013215A05"/>
+ <TestFrame time="2490" hash="AA38FD8E97EC394488274127630E7946"/>
+ <TestFrame time="2520" hash="1CA2B617AC966B54FFA1A61914F68A9D"/>
+ <TestFrame time="2550" hash="1726C0BAA930CAF282154F14AC2FD120"/>
+ <TestFrame time="2580" hash="58F8196148C8B64191AF7B897A811CFB"/>
+ <TestFrame time="2610" hash="D56D3FA137AA63A0215611450B40F3E0"/>
+ <TestFrame time="2640" hash="5E1BCDF996B2903D1EAEAC65E17783C2"/>
+</TestLog>
diff --git a/tests/auto/declarative/visual/flipable/pics/arrow.png b/tests/auto/declarative/visual/flipable/pics/arrow.png
new file mode 100644
index 0000000..997190d
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/arrow.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/face.png b/tests/auto/declarative/visual/flipable/pics/face.png
new file mode 100644
index 0000000..e9529ac
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/face.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo0.png b/tests/auto/declarative/visual/flipable/pics/photo0.png
new file mode 100644
index 0000000..26bbf5b
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo1.png b/tests/auto/declarative/visual/flipable/pics/photo1.png
new file mode 100644
index 0000000..2230f71
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo1.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo10.png b/tests/auto/declarative/visual/flipable/pics/photo10.png
new file mode 100644
index 0000000..119f142
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo10.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo2.png b/tests/auto/declarative/visual/flipable/pics/photo2.png
new file mode 100644
index 0000000..e3d58c1
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo2.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo3.png b/tests/auto/declarative/visual/flipable/pics/photo3.png
new file mode 100644
index 0000000..4b58df4
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo3.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo4.png b/tests/auto/declarative/visual/flipable/pics/photo4.png
new file mode 100644
index 0000000..4ed4bd2
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo4.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo5.png b/tests/auto/declarative/visual/flipable/pics/photo5.png
new file mode 100644
index 0000000..eb26704
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo5.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo6.png b/tests/auto/declarative/visual/flipable/pics/photo6.png
new file mode 100644
index 0000000..69875ce
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo6.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo7.png b/tests/auto/declarative/visual/flipable/pics/photo7.png
new file mode 100644
index 0000000..0b117c9
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo7.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo8.png b/tests/auto/declarative/visual/flipable/pics/photo8.png
new file mode 100644
index 0000000..b77b997
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo8.png
Binary files differ
diff --git a/tests/auto/declarative/visual/flipable/pics/photo9.png b/tests/auto/declarative/visual/flipable/pics/photo9.png
new file mode 100644
index 0000000..8a974d6
--- /dev/null
+++ b/tests/auto/declarative/visual/flipable/pics/photo9.png
Binary files differ
diff --git a/tests/auto/declarative/visual/pauseAnimation/data/raster/image0.png b/tests/auto/declarative/visual/pauseAnimation/data/raster/image0.png
new file mode 100644
index 0000000..8082422
--- /dev/null
+++ b/tests/auto/declarative/visual/pauseAnimation/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/pauseAnimation/data/raster/manifest.qml b/tests/auto/declarative/visual/pauseAnimation/data/raster/manifest.qml
new file mode 100644
index 0000000..40b300d
--- /dev/null
+++ b/tests/auto/declarative/visual/pauseAnimation/data/raster/manifest.qml
@@ -0,0 +1,1264 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+ TestFrame {
+ time: 16
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 32
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 48
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 64
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 80
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 96
+ hash: '336D31586171F22D541B989D24B95CBB'
+ }
+ TestFrame {
+ time: 112
+ hash: '6D63FB5C8A80F0280E88B2CDF8641BB9'
+ }
+ TestFrame {
+ time: 128
+ hash: 'EF8941674CB61F54853DC33652BB854E'
+ }
+ TestFrame {
+ time: 144
+ hash: 'B3F4A2165EC1EE971542B8EF89656CEA'
+ }
+ TestFrame {
+ time: 160
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 176
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 192
+ hash: '21F0B0437A999BBDE66A913032D495C2'
+ }
+ TestFrame {
+ time: 208
+ hash: '0809D32D5BC1BFCE199B1F39A1C68D4F'
+ }
+ TestFrame {
+ time: 224
+ hash: '022137587B39F5123835482178A1F1CF'
+ }
+ TestFrame {
+ time: 240
+ hash: '97566CE9558D13EA0780BCE233097B27'
+ }
+ TestFrame {
+ time: 256
+ hash: '96D79B07DA105B7F631ED61582B26F7E'
+ }
+ TestFrame {
+ time: 272
+ hash: 'F4732FF2DF93FE67CB850DEC34184924'
+ }
+ TestFrame {
+ time: 288
+ hash: '054E6E52F74A3E24F04E6AD0071F79F8'
+ }
+ TestFrame {
+ time: 304
+ hash: 'F541AF93A9FDE62E4BD1C91D30F91E65'
+ }
+ TestFrame {
+ time: 320
+ hash: 'C4F844EE71F23635BB3EC7375F6A134F'
+ }
+ TestFrame {
+ time: 336
+ hash: '3E52E06DB2BF78762BB9816FE6B105D9'
+ }
+ TestFrame {
+ time: 352
+ hash: 'D9604BE23A91327E6AB454609A9D4A13'
+ }
+ TestFrame {
+ time: 368
+ hash: 'DC98A9BDD99367C1E9B838D4BE489DCC'
+ }
+ TestFrame {
+ time: 384
+ hash: 'E87B00BFC2C2A75A4234EC02A057AD3A'
+ }
+ TestFrame {
+ time: 400
+ hash: '5BE4F5C67941EFB6FCEA363C79F1E321'
+ }
+ TestFrame {
+ time: 416
+ hash: '6CC9DE62A0C8FA5E42EAC1B01E99AC32'
+ }
+ TestFrame {
+ time: 432
+ hash: '62A7133012348F2EC3A388FB685ECC3F'
+ }
+ TestFrame {
+ time: 448
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 464
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 480
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 496
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 512
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 528
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 544
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 560
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 576
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 592
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 608
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 624
+ hash: 'FFD39C1122FE2F7877EF30591B539B40'
+ }
+ TestFrame {
+ time: 640
+ hash: '62A7133012348F2EC3A388FB685ECC3F'
+ }
+ TestFrame {
+ time: 656
+ hash: '45281A70021F81DBEF30334B1480DA1B'
+ }
+ TestFrame {
+ time: 672
+ hash: '6CC9DE62A0C8FA5E42EAC1B01E99AC32'
+ }
+ TestFrame {
+ time: 688
+ hash: '79EC710576427DF73DD03F39FBA6E2EB'
+ }
+ TestFrame {
+ time: 704
+ hash: '5BE4F5C67941EFB6FCEA363C79F1E321'
+ }
+ TestFrame {
+ time: 720
+ hash: '7D9096B1EB940C82A37BAF39EF3CCF3E'
+ }
+ TestFrame {
+ time: 736
+ hash: 'E87B00BFC2C2A75A4234EC02A057AD3A'
+ }
+ TestFrame {
+ time: 752
+ hash: 'DA60100DC55023C3BAB367D97C8F6A85'
+ }
+ TestFrame {
+ time: 768
+ hash: 'DC98A9BDD99367C1E9B838D4BE489DCC'
+ }
+ TestFrame {
+ time: 784
+ hash: '3F869538028A09020D5E8F528F4FB119'
+ }
+ TestFrame {
+ time: 800
+ hash: '9650FD0364C01B11E4F5DCCE51D008AF'
+ }
+ TestFrame {
+ time: 816
+ hash: '2CB09D9655ECC30AE6A591B28C0D355C'
+ }
+ TestFrame {
+ time: 832
+ hash: '4DB9BC6C11CAF1D77794C2EABB62A44E'
+ }
+ TestFrame {
+ time: 848
+ hash: 'CE2B5DD7418868ACF86FEA6AD19CC0C5'
+ }
+ TestFrame {
+ time: 864
+ hash: '7C27EF654E645679C90520D6CF00B0C4'
+ }
+ TestFrame {
+ time: 880
+ hash: 'AB3E211DF3EF7F5F7A8D712EDC891C0F'
+ }
+ TestFrame {
+ time: 896
+ hash: '19D2AE617A49B57DD012677E2834469C'
+ }
+ TestFrame {
+ time: 912
+ hash: '5025EB75C88F0760F637E0342B7F88A2'
+ }
+ TestFrame {
+ time: 928
+ hash: '005ACBEF952A8EE536E6308A48223E65'
+ }
+ TestFrame {
+ time: 944
+ hash: 'F1E0301430D153FB9D15EAFFDFCD5C58'
+ }
+ TestFrame {
+ time: 960
+ hash: '5F18A81707F23D377E81A27C1FC41CE9'
+ }
+ TestFrame {
+ time: 976
+ hash: 'BCC35497884C158396C7F60759D1FDA4'
+ }
+ TestFrame {
+ time: 992
+ hash: '7A4528B000A4EA142D1C77407FA1F581'
+ }
+ TestFrame {
+ time: 1008
+ hash: 'BA967A7D810A4531E577E5F6BD2DEF33'
+ }
+ TestFrame {
+ time: 1024
+ hash: 'F5AFD9CF8FFE27E9992454B9E68688CB'
+ }
+ TestFrame {
+ time: 1040
+ hash: '51D475C7F64A86D3A18FB115297A7B6B'
+ }
+ TestFrame {
+ time: 1056
+ hash: '49F5D6FD45C195A8D245B7FEFC1277AB'
+ }
+ TestFrame {
+ time: 1072
+ hash: 'F9B0B278659E3A0F78611E6B7F0F2176'
+ }
+ TestFrame {
+ time: 1088
+ hash: '0809D32D5BC1BFCE199B1F39A1C68D4F'
+ }
+ TestFrame {
+ time: 1104
+ hash: 'B7208D103B63A936DFF8DD8ED224237F'
+ }
+ TestFrame {
+ time: 1120
+ hash: 'A57C81049B0DC68090EC7C3327B9922C'
+ }
+ TestFrame {
+ time: 1136
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1152
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 1168
+ hash: '0C20D12464ABBDC45041EA5D9F2719B1'
+ }
+ TestFrame {
+ time: 1184
+ hash: 'DD60CBAFF6F34027474E92315DBC0EBC'
+ }
+ TestFrame {
+ time: 1200
+ hash: '336D31586171F22D541B989D24B95CBB'
+ }
+ TestFrame {
+ time: 1216
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 1232
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 1248
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 1264
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 1280
+ hash: '336D31586171F22D541B989D24B95CBB'
+ }
+ TestFrame {
+ time: 1296
+ hash: 'F0D8132489C2F2EF760E905B3C093726'
+ }
+ TestFrame {
+ time: 1312
+ hash: '6D63FB5C8A80F0280E88B2CDF8641BB9'
+ }
+ TestFrame {
+ time: 1328
+ hash: 'DD60CBAFF6F34027474E92315DBC0EBC'
+ }
+ TestFrame {
+ time: 1344
+ hash: 'EF8941674CB61F54853DC33652BB854E'
+ }
+ TestFrame {
+ time: 1360
+ hash: 'BC426FB7C31751665B0D3F16E2CB0173'
+ }
+ TestFrame {
+ time: 1376
+ hash: '0C20D12464ABBDC45041EA5D9F2719B1'
+ }
+ TestFrame {
+ time: 1392
+ hash: '53AE93140252373EAA4D9DA73756BD8E'
+ }
+ TestFrame {
+ time: 1408
+ hash: '721D7061811B5439C2E8E395917494BC'
+ }
+ TestFrame {
+ time: 1424
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 1440
+ hash: 'A8B624EBFC9AB713D1CE55F318A6E90D'
+ }
+ TestFrame {
+ time: 1456
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 1472
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 1488
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 1504
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1520
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1536
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1552
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1568
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1584
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1600
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1616
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1632
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 1648
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1664
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 1680
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 1696
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 1712
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 1728
+ hash: 'A8B624EBFC9AB713D1CE55F318A6E90D'
+ }
+ TestFrame {
+ time: 1744
+ hash: 'A8B624EBFC9AB713D1CE55F318A6E90D'
+ }
+ TestFrame {
+ time: 1760
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 1776
+ hash: '721D7061811B5439C2E8E395917494BC'
+ }
+ TestFrame {
+ time: 1792
+ hash: 'B3F4A2165EC1EE971542B8EF89656CEA'
+ }
+ TestFrame {
+ time: 1808
+ hash: '0C20D12464ABBDC45041EA5D9F2719B1'
+ }
+ TestFrame {
+ time: 1824
+ hash: 'BC426FB7C31751665B0D3F16E2CB0173'
+ }
+ TestFrame {
+ time: 1840
+ hash: 'EF8941674CB61F54853DC33652BB854E'
+ }
+ TestFrame {
+ time: 1856
+ hash: 'DD60CBAFF6F34027474E92315DBC0EBC'
+ }
+ TestFrame {
+ time: 1872
+ hash: '6D63FB5C8A80F0280E88B2CDF8641BB9'
+ }
+ TestFrame {
+ time: 1888
+ hash: 'E74FE4A6BD92CBE8629C8BC8A870104D'
+ }
+ TestFrame {
+ time: 1904
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 1920
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 1936
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 1952
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 1968
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 1984
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 2000
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 2016
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 2032
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 2048
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 2064
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 2080
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2096
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2112
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2128
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2144
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2160
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2176
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2192
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 2208
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 2224
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 2240
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 2256
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 2272
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 2288
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 2304
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2320
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 2336
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2352
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2368
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2384
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2400
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 2416
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 2432
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2448
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2464
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2480
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 2496
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 2512
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 3504
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 3520
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 3536
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 3552
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 3568
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 3584
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 3600
+ hash: 'E74FE4A6BD92CBE8629C8BC8A870104D'
+ }
+ TestFrame {
+ time: 3616
+ hash: 'E11455D4E23A5A865E222A7ABA4BA4F9'
+ }
+ TestFrame {
+ time: 3632
+ hash: '8757668E56BE6449EC375F0B8FED1BE3'
+ }
+ TestFrame {
+ time: 3648
+ hash: '53AE93140252373EAA4D9DA73756BD8E'
+ }
+ TestFrame {
+ time: 3664
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 3680
+ hash: '630D90EEF2673A69E8EBC4EF1BA40E81'
+ }
+ TestFrame {
+ time: 3696
+ hash: 'B7208D103B63A936DFF8DD8ED224237F'
+ }
+ TestFrame {
+ time: 3712
+ hash: '1516C3547C7CF64832B3BC7DA7C44521'
+ }
+ TestFrame {
+ time: 3728
+ hash: '49F5D6FD45C195A8D245B7FEFC1277AB'
+ }
+ TestFrame {
+ time: 3744
+ hash: 'F5AFD9CF8FFE27E9992454B9E68688CB'
+ }
+ TestFrame {
+ time: 3760
+ hash: '7A4528B000A4EA142D1C77407FA1F581'
+ }
+ TestFrame {
+ time: 3776
+ hash: '5F18A81707F23D377E81A27C1FC41CE9'
+ }
+ TestFrame {
+ time: 3792
+ hash: '005ACBEF952A8EE536E6308A48223E65'
+ }
+ TestFrame {
+ time: 3808
+ hash: '85C135EF72D3D25658A3663E69FFB7C2'
+ }
+ TestFrame {
+ time: 3824
+ hash: '7C27EF654E645679C90520D6CF00B0C4'
+ }
+ TestFrame {
+ time: 3840
+ hash: '20258F07C613958C32F783466771391A'
+ }
+ TestFrame {
+ time: 3856
+ hash: '9650FD0364C01B11E4F5DCCE51D008AF'
+ }
+ TestFrame {
+ time: 3872
+ hash: 'F340CDF60C6D4C29D26B7202A093EC70'
+ }
+ TestFrame {
+ time: 3888
+ hash: 'D754D35D0793F9F7D4F6249A874E4C45'
+ }
+ TestFrame {
+ time: 3904
+ hash: '79EC710576427DF73DD03F39FBA6E2EB'
+ }
+ TestFrame {
+ time: 3920
+ hash: '45281A70021F81DBEF30334B1480DA1B'
+ }
+ TestFrame {
+ time: 3936
+ hash: 'FFD39C1122FE2F7877EF30591B539B40'
+ }
+ TestFrame {
+ time: 3952
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 3968
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 3984
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 4000
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 4016
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 4032
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 4048
+ hash: '29ECE1BCA4D21FB5862091317D430A13'
+ }
+ TestFrame {
+ time: 4064
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 4080
+ hash: 'C1A7B7D6D64AC5584C073C2881290696'
+ }
+ TestFrame {
+ time: 4096
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 4112
+ hash: '4AC43A03CC6F2020AB5F894D704092AC'
+ }
+ TestFrame {
+ time: 4128
+ hash: 'FFD39C1122FE2F7877EF30591B539B40'
+ }
+ TestFrame {
+ time: 4144
+ hash: '62A7133012348F2EC3A388FB685ECC3F'
+ }
+ TestFrame {
+ time: 4160
+ hash: '45281A70021F81DBEF30334B1480DA1B'
+ }
+ TestFrame {
+ time: 4176
+ hash: '6CC9DE62A0C8FA5E42EAC1B01E99AC32'
+ }
+ TestFrame {
+ time: 4192
+ hash: '79EC710576427DF73DD03F39FBA6E2EB'
+ }
+ TestFrame {
+ time: 4208
+ hash: '5BE4F5C67941EFB6FCEA363C79F1E321'
+ }
+ TestFrame {
+ time: 4224
+ hash: '7D9096B1EB940C82A37BAF39EF3CCF3E'
+ }
+ TestFrame {
+ time: 4240
+ hash: 'E87B00BFC2C2A75A4234EC02A057AD3A'
+ }
+ TestFrame {
+ time: 4256
+ hash: 'DA60100DC55023C3BAB367D97C8F6A85'
+ }
+ TestFrame {
+ time: 4272
+ hash: 'DC98A9BDD99367C1E9B838D4BE489DCC'
+ }
+ TestFrame {
+ time: 4288
+ hash: 'B2C778A5EFF5F01EDC54F03D8B4DE8C7'
+ }
+ TestFrame {
+ time: 4304
+ hash: '9650FD0364C01B11E4F5DCCE51D008AF'
+ }
+ TestFrame {
+ time: 4320
+ hash: '2CB09D9655ECC30AE6A591B28C0D355C'
+ }
+ TestFrame {
+ time: 4336
+ hash: '4DB9BC6C11CAF1D77794C2EABB62A44E'
+ }
+ TestFrame {
+ time: 4352
+ hash: 'CE2B5DD7418868ACF86FEA6AD19CC0C5'
+ }
+ TestFrame {
+ time: 4368
+ hash: 'C4F844EE71F23635BB3EC7375F6A134F'
+ }
+ TestFrame {
+ time: 4384
+ hash: '4E1FDA8A0495EF968C1CFFB1257426D7'
+ }
+ TestFrame {
+ time: 4400
+ hash: '19D2AE617A49B57DD012677E2834469C'
+ }
+ TestFrame {
+ time: 4416
+ hash: 'F438E8D2C16B5DE677924C8411219B19'
+ }
+ TestFrame {
+ time: 4432
+ hash: '005ACBEF952A8EE536E6308A48223E65'
+ }
+ TestFrame {
+ time: 4448
+ hash: '87B71778D52CD8563D171151D4D32407'
+ }
+ TestFrame {
+ time: 4464
+ hash: '691CD8BF5C7802FF6C5024827A379FC6'
+ }
+ TestFrame {
+ time: 4480
+ hash: 'AB442C0173C3D221B6782D28001DAC77'
+ }
+ TestFrame {
+ time: 4496
+ hash: '6F886D4538704C2FAD4D84C68214109F'
+ }
+ TestFrame {
+ time: 4512
+ hash: '56D39F233FAE41C60499D6161F891CBC'
+ }
+ TestFrame {
+ time: 4528
+ hash: '95D987C3FD1352FB81C42C63634FE53B'
+ }
+ TestFrame {
+ time: 4544
+ hash: '96DC84C0C548021910E7C5B580179054'
+ }
+ TestFrame {
+ time: 4560
+ hash: 'DDB71CBD57F6E43744D533D4F72B08DB'
+ }
+ TestFrame {
+ time: 4576
+ hash: 'F7AB4B197BEA455B22F259913438D207'
+ }
+ TestFrame {
+ time: 4592
+ hash: '2AD64CB01C9D50E0118D5ECE0A644DF2'
+ }
+ TestFrame {
+ time: 4608
+ hash: '6579681C59DD571DF0EE4429D74FB5C7'
+ }
+ TestFrame {
+ time: 4624
+ hash: '630D90EEF2673A69E8EBC4EF1BA40E81'
+ }
+ TestFrame {
+ time: 4640
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 4656
+ hash: '721D7061811B5439C2E8E395917494BC'
+ }
+ TestFrame {
+ time: 4672
+ hash: 'BC426FB7C31751665B0D3F16E2CB0173'
+ }
+ TestFrame {
+ time: 4688
+ hash: 'E11455D4E23A5A865E222A7ABA4BA4F9'
+ }
+ TestFrame {
+ time: 4704
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 4720
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 4736
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 4752
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 4768
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 4784
+ hash: '336D31586171F22D541B989D24B95CBB'
+ }
+ TestFrame {
+ time: 4800
+ hash: 'F0D8132489C2F2EF760E905B3C093726'
+ }
+ TestFrame {
+ time: 4816
+ hash: 'E11455D4E23A5A865E222A7ABA4BA4F9'
+ }
+ TestFrame {
+ time: 4832
+ hash: 'DD60CBAFF6F34027474E92315DBC0EBC'
+ }
+ TestFrame {
+ time: 4848
+ hash: '8757668E56BE6449EC375F0B8FED1BE3'
+ }
+ TestFrame {
+ time: 4864
+ hash: 'BC426FB7C31751665B0D3F16E2CB0173'
+ }
+ TestFrame {
+ time: 4880
+ hash: 'B3F4A2165EC1EE971542B8EF89656CEA'
+ }
+ TestFrame {
+ time: 4896
+ hash: '53AE93140252373EAA4D9DA73756BD8E'
+ }
+ TestFrame {
+ time: 4912
+ hash: '721D7061811B5439C2E8E395917494BC'
+ }
+ TestFrame {
+ time: 4928
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 4944
+ hash: 'A8B624EBFC9AB713D1CE55F318A6E90D'
+ }
+ TestFrame {
+ time: 4960
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 4976
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 4992
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 5008
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 5024
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 5040
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5056
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5072
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5088
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5104
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5120
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5136
+ hash: '1373545E43FFF7251CEC9E8375EA267F'
+ }
+ TestFrame {
+ time: 5152
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 5168
+ hash: 'E553F365912586C6408C8C53B1B7D118'
+ }
+ TestFrame {
+ time: 5184
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 5200
+ hash: '3DB5E30EF19EA693C21CCF72892C4390'
+ }
+ TestFrame {
+ time: 5216
+ hash: 'A88A8129259F86DF5A73ADDC3649AD37'
+ }
+ TestFrame {
+ time: 5232
+ hash: 'A8B624EBFC9AB713D1CE55F318A6E90D'
+ }
+ TestFrame {
+ time: 5248
+ hash: 'AF3120FE262D2489C0ED33FBBEE1549F'
+ }
+ TestFrame {
+ time: 5264
+ hash: '721D7061811B5439C2E8E395917494BC'
+ }
+ TestFrame {
+ time: 5280
+ hash: '53AE93140252373EAA4D9DA73756BD8E'
+ }
+ TestFrame {
+ time: 5296
+ hash: 'B3F4A2165EC1EE971542B8EF89656CEA'
+ }
+ TestFrame {
+ time: 5312
+ hash: '0C20D12464ABBDC45041EA5D9F2719B1'
+ }
+ TestFrame {
+ time: 5328
+ hash: '8757668E56BE6449EC375F0B8FED1BE3'
+ }
+ TestFrame {
+ time: 5344
+ hash: 'EF8941674CB61F54853DC33652BB854E'
+ }
+ TestFrame {
+ time: 5360
+ hash: 'E11455D4E23A5A865E222A7ABA4BA4F9'
+ }
+ TestFrame {
+ time: 5376
+ hash: '6D63FB5C8A80F0280E88B2CDF8641BB9'
+ }
+ TestFrame {
+ time: 5392
+ hash: 'E74FE4A6BD92CBE8629C8BC8A870104D'
+ }
+ TestFrame {
+ time: 5408
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5424
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 5440
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 5456
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 5472
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5488
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 5504
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 5520
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 5536
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 5552
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 5568
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 5584
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5600
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5616
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5632
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5648
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5664
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5680
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5696
+ hash: '3042003C067B257DE2CB32F650DDE693'
+ }
+ TestFrame {
+ time: 5712
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 5728
+ hash: 'A725B59B4947357546BBFC7DF3D830AF'
+ }
+ TestFrame {
+ time: 5744
+ hash: 'CE57E27AF329EBA4FAC3AB891F0407CE'
+ }
+ TestFrame {
+ time: 5760
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 5776
+ hash: '41BA853C3403F68A23E708DF82E21C53'
+ }
+ TestFrame {
+ time: 5792
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 5808
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5824
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+ TestFrame {
+ time: 5840
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5856
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5872
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5888
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5904
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 5920
+ hash: 'DCF2867C127E041970047EC8F3EDC04F'
+ }
+ TestFrame {
+ time: 5936
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5952
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5968
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 5984
+ hash: '675EBBDD22DD22CE45993DF4AF1ACFE9'
+ }
+ TestFrame {
+ time: 6000
+ hash: 'A350B70C5238A340E85FD4A3EC0390A3'
+ }
+}
diff --git a/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml
new file mode 100644
index 0000000..2abe83f
--- /dev/null
+++ b/tests/auto/declarative/visual/pauseAnimation/pauseAnimation.qml
@@ -0,0 +1,30 @@
+import Qt 4.6
+
+Rect {
+ id: rect
+ width: 120
+ height: 200
+ color: "white"
+ Image {
+ id: img
+ source: "pics/qtlogo.png"
+ x: 60-width/2
+ y: 200-height
+ y: SequentialAnimation {
+ running: true
+ repeat: true
+ NumberAnimation {
+ to: 0; duration: 500
+ easing: "easeInOutQuad"
+ }
+ NumberAnimation {
+ to: 200-img.height
+ easing: "easeOutBounce"
+ duration: 2000
+ }
+ PauseAnimation {
+ duration: 1000
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/pauseAnimation/pics/qtlogo.png b/tests/auto/declarative/visual/pauseAnimation/pics/qtlogo.png
new file mode 100644
index 0000000..399bd0b
--- /dev/null
+++ b/tests/auto/declarative/visual/pauseAnimation/pics/qtlogo.png
Binary files differ
diff --git a/tests/auto/declarative/visual/pauseAnimation/test b/tests/auto/declarative/visual/pauseAnimation/test
new file mode 100644
index 0000000..85bc3c1
--- /dev/null
+++ b/tests/auto/declarative/visual/pauseAnimation/test
@@ -0,0 +1 @@
+pauseAnimation.qml
diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png
new file mode 100644
index 0000000..05dc9ab
--- /dev/null
+++ b/tests/auto/declarative/visual/qfxtext/elide/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/qfxtext/elide/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/qfxtext/elide/elide.qml b/tests/auto/declarative/visual/qfxtext/elide/elide.qml
new file mode 100644
index 0000000..0372a9c
--- /dev/null
+++ b/tests/auto/declarative/visual/qfxtext/elide/elide.qml
@@ -0,0 +1,35 @@
+import Qt 4.6
+
+Rect {
+ width: contents.width
+ height: contents.height
+ VerticalLayout {
+ width: 80
+ height: Text.height*4
+ Text {
+ elide: "ElideLeft"
+ text: "aaa bbb ccc ddd eee fff"
+ width: 80
+ color: "white"
+ id: Text
+ }
+ Text {
+ elide: "ElideMiddle"
+ text: "aaa bbb ccc ddd eee fff"
+ width: 80
+ color: "white"
+ }
+ Text {
+ elide: "ElideRight"
+ text: "aaa bbb ccc ddd eee fff"
+ width: 80
+ color: "white"
+ }
+ Text {
+ elide: "ElideNone"
+ text: "aaa bbb ccc ddd eee fff"
+ width: 80
+ color: "white"
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/qfxtext/elide/test b/tests/auto/declarative/visual/qfxtext/elide/test
new file mode 100644
index 0000000..bde7c7c
--- /dev/null
+++ b/tests/auto/declarative/visual/qfxtext/elide/test
@@ -0,0 +1 @@
+elide.qml
diff --git a/tests/auto/declarative/visual/repeater/basic1/basic1.qml b/tests/auto/declarative/visual/repeater/basic1/basic1.qml
new file mode 100644
index 0000000..c803de9
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic1/basic1.qml
@@ -0,0 +1,28 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 300
+ height: 200
+ id: Page
+ HorizontalLayout {
+ Repeater {
+ component: Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ dataSource: ListModel {
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png
new file mode 100644
index 0000000..868eaa3
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic1/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic1/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic1/test b/tests/auto/declarative/visual/repeater/basic1/test
new file mode 100644
index 0000000..49fcf5a
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic1/test
@@ -0,0 +1 @@
+basic1.qml
diff --git a/tests/auto/declarative/visual/repeater/basic2/basic2.qml b/tests/auto/declarative/visual/repeater/basic2/basic2.qml
new file mode 100644
index 0000000..bcad407
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic2/basic2.qml
@@ -0,0 +1,32 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 300
+ height: 200
+ id: Page
+ Component {
+ id: Delegate
+ Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+ HorizontalLayout {
+ Repeater {
+ component: Delegate
+ dataSource: ListModel {
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png
new file mode 100644
index 0000000..868eaa3
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic2/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic2/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic2/test b/tests/auto/declarative/visual/repeater/basic2/test
new file mode 100644
index 0000000..eb79495
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic2/test
@@ -0,0 +1 @@
+basic2.qml
diff --git a/tests/auto/declarative/visual/repeater/basic3/basic3.qml b/tests/auto/declarative/visual/repeater/basic3/basic3.qml
new file mode 100644
index 0000000..223e5e8
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic3/basic3.qml
@@ -0,0 +1,30 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 300
+ height: 200
+ id: Page
+ ListModel {
+ id: DataSource
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ HorizontalLayout {
+ Repeater {
+ dataSource: DataSource
+ component: Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png
new file mode 100644
index 0000000..868eaa3
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic3/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml
new file mode 100644
index 0000000..8fd963b
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic3/data/raster/manifest.qml
@@ -0,0 +1,15 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+ TestKey {
+ time: 1296
+ type: 6
+ modifiers: 0
+ key: 16777251
+ text: ''
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic3/test b/tests/auto/declarative/visual/repeater/basic3/test
new file mode 100644
index 0000000..9ec306b
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic3/test
@@ -0,0 +1 @@
+basic3.qml
diff --git a/tests/auto/declarative/visual/repeater/basic4/basic4.qml b/tests/auto/declarative/visual/repeater/basic4/basic4.qml
new file mode 100644
index 0000000..fd78ba2
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic4/basic4.qml
@@ -0,0 +1,34 @@
+import Qt 4.6
+
+Rect {
+ color: "blue"
+ width: 300
+ height: 200
+ id: Page
+ ListModel {
+ id: DataSource
+ ListElement {
+ name: "January"
+ }
+ ListElement {
+ name: "February"
+ }
+ }
+ Component {
+ id: Delegate
+ Rect {
+ color: "red"
+ width: 100
+ height: 100
+ Text {
+ text: name
+ }
+ }
+ }
+ HorizontalLayout {
+ Repeater {
+ dataSource: DataSource
+ component: Delegate
+ }
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png
new file mode 100644
index 0000000..868eaa3
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic4/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic4/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/repeater/basic4/test b/tests/auto/declarative/visual/repeater/basic4/test
new file mode 100644
index 0000000..2a7f227
--- /dev/null
+++ b/tests/auto/declarative/visual/repeater/basic4/test
@@ -0,0 +1 @@
+basic4.qml
diff --git a/tests/auto/declarative/visual/runtests.sh b/tests/auto/declarative/visual/runtests.sh
new file mode 100755
index 0000000..4380884
--- /dev/null
+++ b/tests/auto/declarative/visual/runtests.sh
@@ -0,0 +1,3 @@
+#!/bin/sh
+export QFX_USE_SIMPLECANVAS=1
+for a in `cat tests`; do ./tst_visual -testdir $a; done
diff --git a/tests/auto/declarative/visual/tests b/tests/auto/declarative/visual/tests
new file mode 100644
index 0000000..498edd0
--- /dev/null
+++ b/tests/auto/declarative/visual/tests
@@ -0,0 +1,12 @@
+ListView/basic1
+ListView/basic2
+ListView/basic3
+ListView/basic4
+bindinganimation
+repeater/basic1
+repeater/basic2
+repeater/basic3
+repeater/basic4
+webview/autosize
+qfxtext/elide
+pauseAnimation
diff --git a/tests/auto/declarative/visual/tst_visual.cpp b/tests/auto/declarative/visual/tst_visual.cpp
new file mode 100644
index 0000000..f540e62
--- /dev/null
+++ b/tests/auto/declarative/visual/tst_visual.cpp
@@ -0,0 +1,74 @@
+#include <qtest.h>
+#include <QFxView>
+#include <QApplication>
+#include <QFxTestView>
+#include <QFile>
+
+static QString testdir;
+class tst_visual : public QObject
+{
+ Q_OBJECT
+public:
+ tst_visual() {}
+
+private slots:
+ void visual();
+};
+
+#ifdef QT_OPENGL_ES
+#define RASTER_TESTDIR "/data/opengl"
+#else
+#define RASTER_TESTDIR "/data/raster"
+#endif
+
+void tst_visual::visual()
+{
+ QVERIFY(!testdir.isEmpty());
+
+ QString filename = QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/test";
+ qWarning() << "Using config:" << filename;
+ QFile configFile(filename);
+ QVERIFY(configFile.open(QIODevice::ReadOnly));
+
+ QString testfile = configFile.readLine().trimmed();
+ QVERIFY(!testfile.isEmpty());
+
+ if(testfile.startsWith("QTDIR/")) {
+ testfile.remove(0, 6);
+ testfile.prepend(QLatin1String(QT_TEST_SOURCE_DIR) + "/../../../../");
+ } else {
+ testfile.prepend(QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + "/");
+ }
+
+ QFxTestView *view = new QFxTestView(testfile, QLatin1String(QT_TEST_SOURCE_DIR) + "/" + testdir + RASTER_TESTDIR);
+ QVERIFY(view->runTest());
+}
+
+#include <QtTest/qtest_gui.h>
+
+int main(int argc, char *argv[])
+{
+ int newArgc = 1;
+ char **newArgv = new char*[argc];
+
+ newArgv[0] = argv[0];
+
+ QApplication app(newArgc, newArgv);
+
+ for(int ii = 1; ii < argc; ii++) {
+ if(QLatin1String(argv[ii]) == "-testdir" && (ii + 1) < argc) {
+ testdir = QLatin1String(argv[ii + 1]);
+ ii++;
+ } else {
+ newArgv[newArgc++] = argv[ii];
+ }
+ }
+
+ tst_visual tc;
+ int rv = QTest::qExec(&tc, newArgc, newArgv);
+
+ delete [] newArgv;
+ return rv;
+}
+
+#include "tst_visual.moc"
diff --git a/tests/auto/declarative/visual/visual.pro b/tests/auto/declarative/visual/visual.pro
new file mode 100644
index 0000000..203b691
--- /dev/null
+++ b/tests/auto/declarative/visual/visual.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+contains(QT_CONFIG,declarative): QT += declarative
+SOURCES += tst_visual.cpp
+
+DEFINES += QT_TEST_SOURCE_DIR=\"\\\"$$PWD\\\"\"
diff --git a/tests/auto/declarative/visual/webview/autosize/data/raster/image0.png b/tests/auto/declarative/visual/webview/autosize/data/raster/image0.png
new file mode 100644
index 0000000..206952d
--- /dev/null
+++ b/tests/auto/declarative/visual/webview/autosize/data/raster/image0.png
Binary files differ
diff --git a/tests/auto/declarative/visual/webview/autosize/data/raster/manifest.qml b/tests/auto/declarative/visual/webview/autosize/data/raster/manifest.qml
new file mode 100644
index 0000000..7c21d0f
--- /dev/null
+++ b/tests/auto/declarative/visual/webview/autosize/data/raster/manifest.qml
@@ -0,0 +1,8 @@
+import Qt 4.6
+
+TestLog {
+ TestFullFrame {
+ time: 0
+ frameId: 0
+ }
+}
diff --git a/tests/auto/declarative/visual/webview/autosize/test b/tests/auto/declarative/visual/webview/autosize/test
new file mode 100644
index 0000000..446d3f9
--- /dev/null
+++ b/tests/auto/declarative/visual/webview/autosize/test
@@ -0,0 +1 @@
+QTDIR/examples/declarative/webview/autosize.qml
diff --git a/tests/benchmarks/benchmarks.pro b/tests/benchmarks/benchmarks.pro
index ad1920b..124f909 100644
--- a/tests/benchmarks/benchmarks.pro
+++ b/tests/benchmarks/benchmarks.pro
@@ -19,6 +19,14 @@ SUBDIRS = containers-associative \
qregion \
qvariant \
qwidget \
- qtwidgets
+ qtwidgets \
+ qmlxmlparser \
+ qfxview \
contains(QT_CONFIG, opengl): SUBDIRS += opengl
+
+# Tests which should run in Pulse
+PULSE_TESTS = \
+ qfxview \
+ qmlxmlparser \
+
diff --git a/tests/benchmarks/declarative/binding/binding.pro b/tests/benchmarks/declarative/binding/binding.pro
new file mode 100644
index 0000000..26ee4fa
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/binding.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_binding
+QT += declarative
+
+SOURCES += tst_binding.cpp testtypes.cpp
+HEADERS += testtypes.h
+
diff --git a/tests/benchmarks/declarative/binding/idproperty.txt b/tests/benchmarks/declarative/binding/idproperty.txt
new file mode 100644
index 0000000..0a98e0d
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/idproperty.txt
@@ -0,0 +1,7 @@
+MyQmlObject {
+ id: MyObject
+
+ MyQmlObject {
+ result: ###
+ }
+}
diff --git a/tests/benchmarks/declarative/binding/localproperty.txt b/tests/benchmarks/declarative/binding/localproperty.txt
new file mode 100644
index 0000000..4694d99
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/localproperty.txt
@@ -0,0 +1,3 @@
+MyQmlObject {
+ result: ###
+}
diff --git a/tests/benchmarks/declarative/binding/objectproperty.txt b/tests/benchmarks/declarative/binding/objectproperty.txt
new file mode 100644
index 0000000..597c965
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/objectproperty.txt
@@ -0,0 +1,5 @@
+MyQmlObject {
+ id: MyObject
+
+ result: ###
+}
diff --git a/tests/benchmarks/declarative/binding/testtypes.cpp b/tests/benchmarks/declarative/binding/testtypes.cpp
new file mode 100644
index 0000000..60e69e2
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/testtypes.cpp
@@ -0,0 +1,3 @@
+#include "testtypes.h"
+
+QML_DEFINE_TYPE(MyQmlObject, MyQmlObject);
diff --git a/tests/benchmarks/declarative/binding/testtypes.h b/tests/benchmarks/declarative/binding/testtypes.h
new file mode 100644
index 0000000..20bf5f7
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/testtypes.h
@@ -0,0 +1,41 @@
+#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/binding/tst_binding.cpp b/tests/benchmarks/declarative/binding/tst_binding.cpp
new file mode 100644
index 0000000..e593382
--- /dev/null
+++ b/tests/benchmarks/declarative/binding/tst_binding.cpp
@@ -0,0 +1,126 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QmlEngine>
+#include <QmlComponent>
+#include <QFile>
+#include <QDebug>
+#include "testtypes.h"
+
+//TESTED_FILES=
+
+class tst_binding : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_binding();
+ virtual ~tst_binding();
+
+public slots:
+ void init();
+ void cleanup();
+
+private slots:
+ void objectproperty_data();
+ void objectproperty();
+ void basicproperty_data();
+ void basicproperty();
+
+private:
+ QmlEngine engine;
+};
+
+tst_binding::tst_binding()
+{
+}
+
+tst_binding::~tst_binding()
+{
+}
+
+void tst_binding::init()
+{
+}
+
+void tst_binding::cleanup()
+{
+}
+
+#define COMPONENT(filename, binding) \
+ QmlComponent c(&engine); \
+ { \
+ QFile f(filename); \
+ QVERIFY(f.open(QIODevice::ReadOnly)); \
+ QByteArray data = f.readAll(); \
+ data.replace("###", binding.toUtf8()); \
+ c.setData(data, QUrl()); \
+ QVERIFY(c.isReady()); \
+ }
+
+void tst_binding::objectproperty_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("binding");
+
+ QTest::newRow("object.value") << "objectproperty.txt" << "object.value";
+ QTest::newRow("object.value + 10") << "objectproperty.txt" << "object.value + 10";
+}
+
+void tst_binding::objectproperty()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, binding);
+
+ COMPONENT(file, binding);
+
+ MyQmlObject object1;
+ MyQmlObject object2;
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(c.create());
+ QVERIFY(object != 0);
+ object->setObject(&object2);
+
+ QBENCHMARK {
+ object->setObject(&object1);
+ object->setObject(&object2);
+ }
+}
+
+void tst_binding::basicproperty_data()
+{
+ QTest::addColumn<QString>("file");
+ QTest::addColumn<QString>("binding");
+
+ QTest::newRow("value") << "localproperty.txt" << "value";
+ QTest::newRow("value + 10") << "localproperty.txt" << "value + 10";
+ QTest::newRow("value + value + 10") << "localproperty.txt" << "value + value + 10";
+
+ QTest::newRow("MyObject.value") << "idproperty.txt" << "MyObject.value";
+ QTest::newRow("MyObject.value + 10") << "idproperty.txt" << "MyObject.value + 10";
+ QTest::newRow("MyObject.value + MyObject.value + 10") << "idproperty.txt" << "MyObject.value + MyObject.value + 10";
+}
+
+void tst_binding::basicproperty()
+{
+ QFETCH(QString, file);
+ QFETCH(QString, binding);
+
+ COMPONENT(file, binding);
+
+ MyQmlObject *object = qobject_cast<MyQmlObject *>(c.create());
+ QVERIFY(object != 0);
+ object->setValue(10);
+
+ QBENCHMARK {
+ object->setValue(1);
+ }
+}
+
+QTEST_MAIN(tst_binding)
+#include "tst_binding.moc"
diff --git a/tests/benchmarks/declarative/pointers/pointers.pro b/tests/benchmarks/declarative/pointers/pointers.pro
new file mode 100644
index 0000000..fafdcd6
--- /dev/null
+++ b/tests/benchmarks/declarative/pointers/pointers.pro
@@ -0,0 +1,6 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_pointers
+
+SOURCES += tst_pointers.cpp
+
diff --git a/tests/benchmarks/declarative/pointers/tst_pointers.cpp b/tests/benchmarks/declarative/pointers/tst_pointers.cpp
new file mode 100644
index 0000000..f397c0c
--- /dev/null
+++ b/tests/benchmarks/declarative/pointers/tst_pointers.cpp
@@ -0,0 +1,43 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include "private/qguard_p.h"
+#include <QWeakPointer>
+
+class tst_pointers : public QObject
+{
+ Q_OBJECT
+
+public:
+ tst_pointers() {}
+
+private slots:
+ void guard();
+ void weakPointer();
+};
+
+void tst_pointers::guard()
+{
+ QObject *obj = new QObject;
+ QBENCHMARK {
+ QGuard<QObject> guardedObject;
+ guardedObject = obj;
+ }
+}
+
+void tst_pointers::weakPointer()
+{
+ QObject *obj = new QObject;
+ QBENCHMARK {
+ QWeakPointer<QObject> guardedObject;
+ guardedObject = obj;
+ }
+}
+
+QTEST_MAIN(tst_pointers)
+#include "tst_pointers.moc"
diff --git a/tests/benchmarks/declarative/qmlcomponent/myqmlobject.txt b/tests/benchmarks/declarative/qmlcomponent/myqmlobject.txt
new file mode 100644
index 0000000..9c3f7f8
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/myqmlobject.txt
@@ -0,0 +1,3 @@
+import Qt.test 4.6
+
+MyQmlObject {}
diff --git a/tests/benchmarks/declarative/qmlcomponent/myqmlobject_binding.txt b/tests/benchmarks/declarative/qmlcomponent/myqmlobject_binding.txt
new file mode 100644
index 0000000..e6cc4cf
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/myqmlobject_binding.txt
@@ -0,0 +1,6 @@
+import Qt.test 4.6
+
+MyQmlObject {
+ result: value
+}
+
diff --git a/tests/benchmarks/declarative/qmlcomponent/object.txt b/tests/benchmarks/declarative/qmlcomponent/object.txt
new file mode 100644
index 0000000..85e74b9
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/object.txt
@@ -0,0 +1,3 @@
+import Qt 4.6
+
+Object {}
diff --git a/tests/benchmarks/declarative/qmlcomponent/object_id.txt b/tests/benchmarks/declarative/qmlcomponent/object_id.txt
new file mode 100644
index 0000000..526b6ad
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/object_id.txt
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+Object {
+ id: Blah
+}
+
diff --git a/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro
new file mode 100644
index 0000000..5f0cbe6
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/qmlcomponent.pro
@@ -0,0 +1,8 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qmlcomponent
+QT += declarative
+
+SOURCES += tst_qmlcomponent.cpp testtypes.cpp
+HEADERS += testtypes.h
+
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/BoomBlock.qml b/tests/benchmarks/declarative/qmlcomponent/samegame/BoomBlock.qml
new file mode 100644
index 0000000..7860cf4
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/BoomBlock.qml
@@ -0,0 +1,54 @@
+import Qt 4.6
+
+Item { id:block
+ property bool dying: false
+ property bool spawned: false
+ property int type: 0
+ property int targetX: 0
+ property int targetY: 0
+
+ x: Follow { enabled: spawned; source: targetX; spring: 2; damping: 0.2 }
+ y: Follow { source: targetY; spring: 2; damping: 0.2 }
+
+ Image { id: img
+ source: {
+ if(type == 0){
+ "pics/redStone.png";
+ } else if(type == 1) {
+ "pics/blueStone.png";
+ } else {
+ "pics/greenStone.png";
+ }
+ }
+ opacity: 0
+ opacity: Behavior { NumberAnimation { properties:"opacity"; duration: 200 } }
+ anchors.fill: parent
+ }
+
+ Particles { id: particles
+ width:1; height:1; anchors.centerIn: parent; opacity: 0
+ lifeSpan: 700; lifeSpanDeviation: 600; count:0; streamIn: false
+ angle: 0; angleDeviation: 360; velocity: 100; velocityDeviation:30
+ source: {
+ if(type == 0){
+ "pics/redStar.png";
+ } else if (type == 1) {
+ "pics/blueStar.png";
+ } else {
+ "pics/greenStar.png";
+ }
+ }
+ }
+
+ states: [
+ State{ name: "AliveState"; when: spawned == true && dying == false
+ PropertyChanges { target: img; opacity: 1 }
+ },
+ State{ name: "DeathState"; when: dying == true
+ PropertyChanges { target: particles; count: 50 }
+ PropertyChanges { target: particles; opacity: 1 }
+ PropertyChanges { target: particles; emitting: false } // i.e. emit only once
+ PropertyChanges { target: img; opacity: 0 }
+ }
+ ]
+}
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStar.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStar.png
new file mode 100644
index 0000000..ff9588f
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStar.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStone.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStone.png
new file mode 100644
index 0000000..bf342e0
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/blueStone.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStar.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStar.png
new file mode 100644
index 0000000..cd06854
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStar.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStone.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStone.png
new file mode 100644
index 0000000..5ac14a5
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/greenStone.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStar.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStar.png
new file mode 100644
index 0000000..0a4dffe
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStar.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStone.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStone.png
new file mode 100644
index 0000000..b099f60
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/redStone.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/samegame/pics/yellowStone.png b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/yellowStone.png
new file mode 100644
index 0000000..c56124a
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/samegame/pics/yellowStone.png
Binary files differ
diff --git a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt
new file mode 100644
index 0000000..90db37c
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.2.txt
@@ -0,0 +1,15 @@
+import Qt 4.6
+
+Object {
+ property int a
+ property bool b
+ property double c
+ property real d
+ property string e
+ property url f
+ property color g
+ property date h
+ property var i
+ property variant j
+}
+
diff --git a/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt
new file mode 100644
index 0000000..bb5469a
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/synthesized_properties.txt
@@ -0,0 +1,5 @@
+import Qt 4.6
+
+Object {
+ property int a
+}
diff --git a/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp b/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp
new file mode 100644
index 0000000..5021bf3
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/testtypes.cpp
@@ -0,0 +1,3 @@
+#include "testtypes.h"
+
+QML_DEFINE_TYPE(Qt/test, 4, 6, 6, MyQmlObject, MyQmlObject);
diff --git a/tests/benchmarks/declarative/qmlcomponent/testtypes.h b/tests/benchmarks/declarative/qmlcomponent/testtypes.h
new file mode 100644
index 0000000..20bf5f7
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/testtypes.h
@@ -0,0 +1,41 @@
+#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
new file mode 100644
index 0000000..f0e029d
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlcomponent/tst_qmlcomponent.cpp
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#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") << "object.txt";
+ QTest::newRow("Object - Id") << "object_id.txt";
+ QTest::newRow("MyQmlObject") << "myqmlobject.txt";
+ QTest::newRow("MyQmlObject: basic binding") << "myqmlobject_binding.txt";
+ QTest::newRow("Synthesized properties") << "synthesized_properties.txt";
+ QTest::newRow("Synthesized properties.2") << "synthesized_properties.2.txt";
+ QTest::newRow("SameGame - BoomBlock") << "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/qmlmetaproperty/object.txt b/tests/benchmarks/declarative/qmlmetaproperty/object.txt
new file mode 100644
index 0000000..11b95e1
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlmetaproperty/object.txt
@@ -0,0 +1,3 @@
+import Qt 4.6
+
+Item {}
diff --git a/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro
new file mode 100644
index 0000000..b4e83d7
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlmetaproperty/qmlmetaproperty.pro
@@ -0,0 +1,7 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qmlmetaproperty
+QT += declarative
+
+SOURCES += tst_qmlmetaproperty.cpp
+
diff --git a/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt b/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt
new file mode 100644
index 0000000..a923a0a
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlmetaproperty/synthesized_object.txt
@@ -0,0 +1,6 @@
+import Qt 4.6
+
+Item {
+ property int blah
+}
+
diff --git a/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp b/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
new file mode 100644
index 0000000..c22af03
--- /dev/null
+++ b/tests/benchmarks/declarative/qmlmetaproperty/tst_qmlmetaproperty.cpp
@@ -0,0 +1,79 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+****************************************************************************/
+
+#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") << "object.txt";
+ QTest::newRow("Synthesized Object") << "synthesized_object.txt";
+}
+
+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/qmlpainting/qmlpainting.pro b/tests/benchmarks/qmlpainting/qmlpainting.pro
new file mode 100644
index 0000000..58e9775
--- /dev/null
+++ b/tests/benchmarks/qmlpainting/qmlpainting.pro
@@ -0,0 +1,5 @@
+load(qttest_p4)
+TEMPLATE = app
+TARGET = tst_qmlpainting
+
+SOURCES += tst_qmlpainting.cpp
diff --git a/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp
new file mode 100644
index 0000000..ae6f9a3
--- /dev/null
+++ b/tests/benchmarks/qmlpainting/tst_qmlpainting.cpp
@@ -0,0 +1,696 @@
+/****************************************************************************
+**
+** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Contact: Qt Software Information (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 either Technology Preview License Agreement or the
+** Beta Release License Agreement.
+**
+** 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.0, included in the file LGPL_EXCEPTION.txt in this
+** package.
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 3.0 as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU General Public License version 3.0 requirements will be
+** met: http://www.gnu.org/copyleft/gpl.html.
+**
+** If you are unsure which license is appropriate for your use, please
+** contact the sales department at qt-sales@nokia.com.
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#include <qtest.h>
+#include <QPainter>
+#include <QImage>
+
+#include <math.h>
+#ifndef M_PI
+#define M_PI 3.14159265358979323846
+#endif
+
+class tst_QmlPainting : public QObject
+{
+ Q_OBJECT
+
+ public:
+ tst_QmlPainting() {}
+
+private slots:
+ void drawRoundedRect();
+ void drawScaledRoundedRect();
+ void drawTransformedRoundedRect();
+ void drawAntialiasedRoundedRect();
+ void drawScaledAntialiasedRoundedRect_data();
+ void drawScaledAntialiasedRoundedRect();
+ void drawTransformedAntialiasedRoundedRect_data();
+ void drawTransformedAntialiasedRoundedRect();
+ void drawImageRoundedRect();
+ void drawScaledImageRoundedRect_data();
+ void drawScaledImageRoundedRect();
+ void drawTransformedImageRoundedRect_data();
+ void drawTransformedImageRoundedRect();
+ void drawScaleGridRoundedRect();
+ void drawScaledScaleGridRoundedRect_data();
+ void drawScaledScaleGridRoundedRect();
+ void drawTransformedScaleGridRoundedRect_data();
+ void drawTransformedScaleGridRoundedRect();
+ void drawTransformedTransparentImage_data();
+ void drawTransformedTransparentImage();
+ void drawTransformedSemiTransparentImage_data();
+ void drawTransformedSemiTransparentImage();
+ void drawTransformedFilledImage_data();
+ void drawTransformedFilledImage();
+};
+
+const qreal inv_dist_to_plane = 1. / 1024.;
+QTransform transformForAngle(qreal angle)
+{
+ QTransform transform;
+
+ QTransform rotTrans;
+ rotTrans.translate(-40, 0);
+ QTransform rotTrans2;
+ rotTrans2.translate(40, 0);
+
+ qreal rad = angle * 2. * M_PI / 360.;
+ qreal c = ::cos(rad);
+ qreal s = ::sin(rad);
+
+ qreal x = 0;
+ qreal y = 80;
+ qreal z = 0;
+
+ qreal len = x * x + y * y + z * z;
+ if (len != 1.) {
+ len = ::sqrt(len);
+ x /= len;
+ y /= len;
+ z /= len;
+ }
+
+ QTransform rot(x*x*(1-c)+c, x*y*(1-c)-z*s, x*z*(1-c)+y*s*inv_dist_to_plane,
+ y*x*(1-c)+z*s, y*y*(1-c)+c, y*z*(1-c)-x*s*inv_dist_to_plane,
+ 0, 0, 1);
+
+ transform *= rotTrans;
+ transform *= rot;
+ transform *= rotTrans2;
+
+ return transform;
+}
+
+void tst_QmlPainting::drawRoundedRect()
+{
+ QImage surface(100, 100, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+
+ QBENCHMARK {
+ p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10);
+ }
+ surface.save("regular.png");
+}
+
+void tst_QmlPainting::drawScaledRoundedRect()
+{
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+ p.scale(3, 3);
+
+ QBENCHMARK {
+ p.drawRoundedRect(10, 10, 80, 80, 10, 10);
+ }
+ surface.save("scaled.png");
+}
+
+void tst_QmlPainting::drawTransformedRoundedRect()
+{
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+
+ QBENCHMARK {
+ p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953));
+ p.drawRoundedRect(100, 100, 80, 80, 10, 10);
+ }
+ surface.save("transformed.png");
+}
+
+void tst_QmlPainting::drawAntialiasedRoundedRect()
+{
+ QImage surface(100, 100, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+
+ QBENCHMARK {
+ p.drawRoundedRect(QRectF(.5, .5, 80, 80), 10, 10);
+ }
+ surface.save("aar.png");
+}
+
+void tst_QmlPainting::drawScaledAntialiasedRoundedRect_data()
+{
+ QTest::addColumn<float>("scale");
+
+ for (float i = 0; i < 3; i += .1)
+ QTest::newRow(QString(QLatin1String("scale=%1")).arg(i).toLatin1()) << i;
+}
+
+void tst_QmlPainting::drawScaledAntialiasedRoundedRect()
+{
+ QFETCH(float, scale);
+
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+ p.scale(scale, scale);
+
+ QBENCHMARK {
+ p.drawRoundedRect(10, 10, 80, 80, 10, 10);
+ }
+ surface.save("aas.png");
+}
+
+void tst_QmlPainting::drawTransformedAntialiasedRoundedRect_data()
+{
+ QTest::addColumn<QTransform>("transform");
+
+ for (float angle = 0; angle < 360; angle += 10)
+ QTest::newRow(QString(QLatin1String("angle=%1")).arg(angle).toLatin1()) << transformForAngle(angle);
+}
+
+void tst_QmlPainting::drawTransformedAntialiasedRoundedRect()
+{
+ QFETCH(QTransform, transform);
+
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ p.setRenderHint(QPainter::Antialiasing, true);
+ p.setPen(QPen(Qt::black, 1));
+ p.setBrush(Qt::red);
+
+ QBENCHMARK {
+ p.setWorldTransform(transform);
+ p.drawRoundedRect(100, 100, 80, 80, 10, 10);
+ }
+ surface.save("aat.png");
+}
+
+void tst_QmlPainting::drawImageRoundedRect()
+{
+ //setup image
+ const int radius = 10;
+ QImage rectImage(81, 81, QImage::Format_ARGB32_Premultiplied);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius);
+
+ //setup surface
+ QImage surface(100, 100, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.drawImage(0,0, rectImage);
+ }
+ surface.save("ri.png");
+}
+
+void tst_QmlPainting::drawScaledImageRoundedRect_data()
+{
+ QTest::addColumn<int>("imageType");
+
+ QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+void tst_QmlPainting::drawScaledImageRoundedRect()
+{
+ QFETCH(int, imageType);
+
+ //setup image
+ const int radius = 10;
+ QImage rectImage(81, 81, (QImage::Format)imageType);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius);
+
+ //setup surface
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+ p.scale(3, 3);
+
+ QBENCHMARK {
+ p.drawImage(0,0, rectImage);
+ }
+ surface.save("si.png");
+}
+
+void tst_QmlPainting::drawTransformedImageRoundedRect_data()
+{
+ QTest::addColumn<int>("imageType");
+
+ QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+void tst_QmlPainting::drawTransformedImageRoundedRect()
+{
+ QFETCH(int, imageType);
+
+ //setup image
+ const int radius = 10;
+ QImage rectImage(81, 81, (QImage::Format)imageType);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ rp.drawRoundedRect(QRectF(.5, .5, 80, 80), radius, radius);
+
+ //setup surface
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953));
+ p.drawImage(100,100, rectImage);
+ }
+ surface.save("ti.png");
+}
+
+//code from QFxRect for drawing rounded rects
+void tst_QmlPainting::drawScaleGridRoundedRect()
+{
+ //setup image
+ const int pw = 1;
+ const int radius = 10;
+ QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, QImage::Format_ARGB32_Premultiplied);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ if (pw%2)
+ rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius);
+ else
+ rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius);
+
+ //setup surface
+ QImage surface(100, 100, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ const int pw = 2;
+ int offset = int(radius+1.5+pw);
+ int width = 80;
+ int height = 80;
+
+ int w = width+pw;
+ int h = height+pw;
+ int xOffset = offset;
+ int xSide = xOffset * 2;
+ bool xMiddles=true;
+ if (xSide > w) {
+ xMiddles=false;
+ xOffset = w/2 + 1;
+ xSide = xOffset * 2;
+ }
+ int yOffset = offset;
+ int ySide = yOffset * 2;
+ bool yMiddles=true;
+ if (ySide > h) {
+ yMiddles = false;
+ yOffset = h/2 + 1;
+ ySide = yOffset * 2;
+ }
+
+ // Upper left
+ p.drawImage(QRect(-pw/2, -pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset));
+
+ // Upper middle
+ if (xMiddles)
+ p.drawImage(QRect(xOffset-pw/2, -pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, 0, 1, yOffset));
+ // Upper right
+ p.drawImage(QPoint(width-xOffset+pw/2, -pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, 0, xOffset, yOffset));
+ // Middle left
+ if (yMiddles)
+ p.drawImage(QRect(-pw/2, yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(0, rectImage.height()/2, xOffset, 1));
+
+ // Middle
+ if (xMiddles && yMiddles)
+ p.drawImage(QRect(xOffset-pw/2, yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage,
+ QRect(rectImage.width()/2, rectImage.height()/2, 1, 1));
+ // Middle right
+ if (yMiddles)
+ p.drawImage(QRect(width-xOffset+pw/2, yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1));
+ // Lower left
+ p.drawImage(QPoint(-pw/2, height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset));
+
+ // Lower Middle
+ if (xMiddles)
+ p.drawImage(QRect(xOffset-pw/2, height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset));
+ // Lower Right
+ p.drawImage(QPoint(width-xOffset+pw/2, height - yOffset+pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset));
+ }
+ surface.save("rsg.png");
+}
+
+void tst_QmlPainting::drawScaledScaleGridRoundedRect_data()
+{
+ QTest::addColumn<float>("scale");
+ QTest::addColumn<int>("imageType");
+
+ for (float i = 0; i < 3; i += .1)
+ QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB32_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB32_Premultiplied;
+ //for (float i = 0; i < 3; i += .1)
+ // QTest::newRow(QString(QLatin1String("scale=%1; imagetype=ARGB8565_Pre")).arg(i).toLatin1()) << i << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+//code from QFxRect for drawing rounded rects
+void tst_QmlPainting::drawScaledScaleGridRoundedRect()
+{
+ QFETCH(float, scale);
+ QFETCH(int, imageType);
+
+ //setup image
+ const int pw = 1;
+ const int radius = 10;
+ QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ if (pw%2)
+ rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius);
+ else
+ rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius);
+
+ //setup surface
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+ p.scale(scale, scale);
+
+ QBENCHMARK {
+ const int pw = 2;
+ int offset = int(radius+1.5+pw);
+ int width = 80;
+ int height = 80;
+
+ int w = width+pw;
+ int h = height+pw;
+ int xOffset = offset;
+ int xSide = xOffset * 2;
+ bool xMiddles=true;
+ if (xSide > w) {
+ xMiddles=false;
+ xOffset = w/2 + 1;
+ xSide = xOffset * 2;
+ }
+ int yOffset = offset;
+ int ySide = yOffset * 2;
+ bool yMiddles=true;
+ if (ySide > h) {
+ yMiddles = false;
+ yOffset = h/2 + 1;
+ ySide = yOffset * 2;
+ }
+
+ // Upper left
+ p.drawImage(QRect(10-pw/2, 10-pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset));
+
+ // Upper middle
+ if (xMiddles)
+ p.drawImage(QRect(10+xOffset-pw/2, 10+-pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, 0, 1, yOffset));
+ // Upper right
+ p.drawImage(QPoint(10+width-xOffset+pw/2, 10+-pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, 0, xOffset, yOffset));
+ // Middle left
+ if (yMiddles)
+ p.drawImage(QRect(10+-pw/2, 10+yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(0, rectImage.height()/2, xOffset, 1));
+
+ // Middle
+ if (xMiddles && yMiddles)
+ p.drawImage(QRect(10+xOffset-pw/2, 10+yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage,
+ QRect(rectImage.width()/2, rectImage.height()/2, 1, 1));
+ // Middle right
+ if (yMiddles)
+ p.drawImage(QRect(10+width-xOffset+pw/2, 10+yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1));
+ // Lower left
+ p.drawImage(QPoint(10+-pw/2, 10+height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset));
+
+ // Lower Middle
+ if (xMiddles)
+ p.drawImage(QRect(10+xOffset-pw/2, 10+height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset));
+ // Lower Right
+ p.drawImage(QPoint(10+width-xOffset+pw/2, 10+height - yOffset+pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset));
+ }
+ surface.save("ssg.png");
+}
+
+void tst_QmlPainting::drawTransformedScaleGridRoundedRect_data()
+{
+ QTest::addColumn<QTransform>("transform");
+ QTest::addColumn<int>("imageType");
+
+ for (float angle = 0; angle < 360; angle += 10)
+ QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB32_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB32_Premultiplied;
+ //for (float angle = 0; angle < 360; angle += 10)
+ // QTest::newRow(QString(QLatin1String("angle=%1; imagetype=ARGB8565_Pre")).arg(angle).toLatin1()) << transformForAngle(angle) << (int)QImage::Format_ARGB8565_Premultiplied;
+
+}
+
+//code from QFxRect for drawing rounded rects
+void tst_QmlPainting::drawTransformedScaleGridRoundedRect()
+{
+ QFETCH(QTransform, transform);
+ QFETCH(int, imageType);
+
+ //setup image
+ const int pw = 1;
+ const int radius = 10;
+ QImage rectImage(radius*2 + 3 + pw*2, radius*2 + 3 + pw*2, (QImage::Format)imageType);
+ rectImage.fill(0);
+ QPainter rp(&rectImage);
+ rp.setRenderHint(QPainter::Antialiasing);
+ rp.setPen(Qt::black);
+ rp.setBrush(Qt::red);
+ if (pw%2)
+ rp.drawRoundedRect(QRectF(qreal(pw)/2+1, qreal(pw)/2+1, rectImage.width()-(pw+1), rectImage.height()-(pw+1)), radius, radius);
+ else
+ rp.drawRoundedRect(QRectF(qreal(pw)/2, qreal(pw)/2, rectImage.width()-pw, rectImage.height()-pw), radius, radius);
+
+ //setup surface
+ QImage surface(400, 400, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.setWorldTransform(transform);
+ const int pw = 2;
+ int offset = int(radius+1.5+pw);
+ int width = 80;
+ int height = 80;
+
+ int w = width+pw;
+ int h = height+pw;
+ int xOffset = offset;
+ int xSide = xOffset * 2;
+ bool xMiddles=true;
+ if (xSide > w) {
+ xMiddles=false;
+ xOffset = w/2 + 1;
+ xSide = xOffset * 2;
+ }
+ int yOffset = offset;
+ int ySide = yOffset * 2;
+ bool yMiddles=true;
+ if (ySide > h) {
+ yMiddles = false;
+ yOffset = h/2 + 1;
+ ySide = yOffset * 2;
+ }
+
+ // Upper left
+ p.drawImage(QRect(100-pw/2, 100-pw/2, xOffset, yOffset), rectImage, QRect(0, 0, xOffset, yOffset));
+
+ // Upper middle
+ if (xMiddles)
+ p.drawImage(QRect(100+xOffset-pw/2, 100+-pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, 0, 1, yOffset));
+ // Upper right
+ p.drawImage(QPoint(100+width-xOffset+pw/2, 100+-pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, 0, xOffset, yOffset));
+ // Middle left
+ if (yMiddles)
+ p.drawImage(QRect(100+-pw/2, 100+yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(0, rectImage.height()/2, xOffset, 1));
+
+ // Middle
+ if (xMiddles && yMiddles)
+ p.drawImage(QRect(100+xOffset-pw/2, 100+yOffset-pw/2, width - xSide + pw, height - ySide + pw), rectImage,
+ QRect(rectImage.width()/2, rectImage.height()/2, 1, 1));
+ // Middle right
+ if (yMiddles)
+ p.drawImage(QRect(100+width-xOffset+pw/2, 100+yOffset-pw/2, xOffset, height - ySide + pw), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height()/2, xOffset, 1));
+ // Lower left
+ p.drawImage(QPoint(100+-pw/2, 100+height - yOffset + pw/2), rectImage, QRect(0, rectImage.height() - yOffset, xOffset, yOffset));
+
+ // Lower Middle
+ if (xMiddles)
+ p.drawImage(QRect(100+xOffset-pw/2, 100+height - yOffset +pw/2, width - xSide + pw, yOffset), rectImage,
+ QRect(rectImage.width()/2, rectImage.height() - yOffset, 1, yOffset));
+ // Lower Right
+ p.drawImage(QPoint(100+width-xOffset+pw/2, 100+height - yOffset+pw/2), rectImage,
+ QRect(rectImage.width()-xOffset, rectImage.height() - yOffset, xOffset, yOffset));
+ }
+ surface.save("tsg.png");
+}
+
+void tst_QmlPainting::drawTransformedTransparentImage_data()
+{
+ QTest::addColumn<int>("imageType");
+
+ QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+void tst_QmlPainting::drawTransformedTransparentImage()
+{
+ QFETCH(int, imageType);
+
+ //setup image
+ QImage transImage(200, 200, (QImage::Format)imageType);
+ transImage.fill(0);
+
+ //setup surface
+ QImage surface(200, 200, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953));
+ p.drawImage(0,0, transImage);
+ }
+}
+
+void tst_QmlPainting::drawTransformedSemiTransparentImage_data()
+{
+ QTest::addColumn<int>("imageType");
+
+ QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+void tst_QmlPainting::drawTransformedSemiTransparentImage()
+{
+ QFETCH(int, imageType);
+
+ //setup image
+ QImage transImage(200, 200, (QImage::Format)imageType);
+ transImage.fill(QColor(0,0,0, 128).rgba());
+
+ //setup surface
+ QImage surface(200, 200, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953));
+ p.drawImage(0,0, transImage);
+ }
+}
+
+void tst_QmlPainting::drawTransformedFilledImage_data()
+{
+ QTest::addColumn<int>("imageType");
+
+ QTest::newRow("imagetype=ARGB32_Pre") << (int)QImage::Format_ARGB32_Premultiplied;
+ QTest::newRow("imagetype=ARGB8565_Pre") << (int)QImage::Format_ARGB8565_Premultiplied;
+}
+
+void tst_QmlPainting::drawTransformedFilledImage()
+{
+ QFETCH(int, imageType);
+
+ //setup image
+ QImage filledImage(200, 200, (QImage::Format)imageType);
+ filledImage.fill(QColor(0,0,0).rgb());
+
+ //setup surface
+ QImage surface(200, 200, QImage::Format_RGB16);
+ surface.fill(QColor(255,255,255).rgb());
+ QPainter p(&surface);
+
+ QBENCHMARK {
+ p.setWorldTransform(QTransform(0.956957, 0, 0.000704124, 0, 1, 0, 16.141, 0, 0.735953));
+ p.drawImage(0,0, filledImage);
+ }
+}
+
+QTEST_MAIN(tst_QmlPainting)
+
+#include "tst_qmlpainting.moc"